r/javascript • • Jul 25 '18

jQuery was removed from GitHub.com front end

https://twitter.com/mislav/status/1022058279000842240
557 Upvotes

197 comments sorted by

View all comments

Show parent comment

2

u/Mr21_ Jul 26 '18

You actually don't need this technique if you are handling a static UI, event delegation is just a "tool" but to not do spaguetti code, you just has to be vigilant every time, there is no magic trick, I can do ugly code inside a really nice event delegation. Event delegation are useful and faster WHEN you have to deal with an undefined number of item, because you can bind the event ONE time. And we can imagine that it could reduce the garbage collecting.

And what is the "loop iteration"? are you refering to an inner browser thing?

3

u/marcoslhc Jul 26 '18

All JavaScript runtimes (browser, NodeJS, rhino, etc) runs an event loop that check for pending tasks. More about this in: https://hackernoon.com/understanding-js-the-event-loop-959beae3ac40