You should be able to:
- Set up event listeners to handle DOM events
- Explain the concepts of event delegation, event bubbling, and event delegation
- Be able to stop an event from bubbling
target.addEventListener(type, listener [, options]);
target.addEventListener(type, listener [, useCapture]);- Capturing Phase
- Target Phase
- Bubbling Phase
- Reference: An Introduction to DOM Events
- To write an event listener once on a parent node and have it propagate through all the elements between the parent and the target. This allows a common ancestor do work that would have been otherwise repetitive over many different children.
event.stopPropogation()- This prevents any callbacks from being fired on any nodes further along the event chain, but it does not prevent any additional callbacks of the same event name from being fired on the current node.