Re:Differences Between jQuery .bind() vs .live() vs .delegat...
by davej on Monday February 06, 2012 @10:23AM
(#3557671)
Yep, the best advice for a newcomer is to just use `.on()` and familiarise yourself with that API. You can ignore the other event handler methods because they're all just shortcuts or legacy methods.
[ Parent
| on HN ]
Re:Differences Between jQuery .bind() vs .live() vs .delegat...
by emehrkay on Monday February 06, 2012 @10:35AM
(#3557710)
I like MooTools. When they added event delegation to their library, they simply modified the existing addEvent method to parse the event name instead of adding new method after new method -- seems like a more thought out approach.
$(selector').addEvent('click:relay(selector)', fn)
Re:Differences Between jQuery .bind() vs .live() vs .delegat...
by dmethvin on Monday February 06, 2012 @10:32AM
(#3557691)
Exactly. It would simplify the documentation to simply deprecate everything but .on() but would that justify breaking all the existing code out there? Not to me. The old APIs need to stay around so that code continues to work.
Re:Differences Between jQuery .bind() vs .live() vs .delegat...
by cgoddard on Tuesday February 07, 2012 @01:43PM
(#3563130)
Even if they excised the old methods from the code, hopefully no one is linking to jQuery trunk or something as their primary library. The old versions would still be around. Just some simple work might have to be done to update a web app to using the latest versions of jQuery.
Re:Differences Between jQuery .bind() vs .live() vs .delegat...
by cgoddard on Tuesday February 07, 2012 @01:40PM
(#3563111)
They could deprecate the old methods and still keep them around as long as makes sense. There's no rule that deprecated methods have to be gotten rid of during the next major revision or anything.