The bubble phase is the upward part of event propagation. After an event reaches its target, it dispatches to the target’s parent and continues through each ancestor until reaching window. section 8.3.1
Event dispatch proceeds through three stages:
- Capture phase moves from window down through the ancestors. section 8.3.1
- Target phase dispatches the event on the target element. section 8.3.1
- Bubble phase moves from the target’s parent upward through the ancestors. section 8.3.1
Listening during bubbling
A normal event listener handles bubbling and target phases by default: element.addEventListener("click", onClick);. Inspect event.eventPhase to distinguish bubbling, whose value is Event.BUBBLING_PHASE (3), from capture and target phases. section 8.3.1
Figure 8.7 When you click the black button, the browser will start propagating events throughout the nodes in the document starting at the window, moving down through the document tree in the capture phase until the target, and then moving back up the tree in the bubbling phase until it reaches the window.
Follow the event’s path from window to the clicked button during capture, then back upward during bubbling. section 8.3.1
