$('#foo').live('click', myfunc )
Would have poor performance compared to:
$('#foo').bind('click', myfunc )Live is good in cases where you want to delegate amongst a large number of nodes. If you only have one or two, then it just reduces performance because then the delegated functions get called a huge amount of time, ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com] -Nadir-Point (http://nadir-point.com) -Wiki-Tools (http://wiki-tools.com) -MonkeyScript (http://monkeyscript.nadir-point.com) -Animepedia (http://anime.wikia.com) -Narutopedia (http://naruto.wikia.com) -Soul Eater Wiki (http://souleater.wikia.com) weepy wrote: > I recently created a grid with ~1000 squares and each set a click > event handler to each. > > $(".sq").bind("click", myfunc ) > > Needless to say, it was extremely slow. Thankfully I could simply > switch to event delegation and far better performance by simply > switching to the following: > > $(".sq").live("click", myfunc ) > > Rock on 1.3.1 ! > > So my question : - Is there any reason *not* to use live event > handlers for pretty much everything ? (other than of course the events > and selectors that don't work). > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
