DEV Community

Discussion on: Quick Tip: Managing event listeners with bound callbacks

Collapse
 
abrahamtourdex profile image
Abraham Brookes

I assign my event listeners to the document, and check against the event.target to see what should happen when the event is triggered. I figure this eliminates a slew of event listeners and is good for optimization. I don't think the benefits of removing event handlers would really be worth it in my case, what do you think? Are you more referring to a situation in which you have lots of dynamically added elements? I would still lean towards capturing their events on the document, I think.