event delegation
-
Event delegationWeb/DOMBrowser 2019. 9. 29. 01:40
1. Overview Capturing and bubbling allow us to implement one of the most powerful event handling patterns called event delegation. The idea is that if we have a lot of elements handled in a similar way, then instead of assigning a handler to each of them – we put a single handler on their common ancestor. In the handler we get event.target, see where the event actually happened and handle it. 2...