Timeline for Direct vs. Delegated - jQuery .on()
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 12, 2018 at 20:43 | comment | added | cowbert |
In modern browsers, $('body').on() delegation from .element should behave exactly the same as native document.body.addEventHandler() with an if (Event.target.className.matches(/\belement\b/)) in the callback. It may be very slightly slower in jquery due to $.proxy overhead but don't quote me on that.
|
|
Sep 6, 2016 at 12:58 | comment | added | Maciej Sikora | Jquery removed live method which was doing the same as You showed. This is performance weak and should not be used. | |
Apr 28, 2015 at 21:19 | comment | added | mikesoft | jquery advises against using body, as it is slower, because the script would have to search for all childs inside body, which should be a lot in most cases. It's better (faster) to use the inmediate parent container of the element. | |
Apr 25, 2014 at 16:42 | history | answered | Brynner Ferreira | CC BY-SA 3.0 |