Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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)


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.


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.


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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: