Last updated 1 year ago
browser ⟩ event ⟩ propagation
the process by which the browser decides which objects to trigger event handlers on.
3 phases of event propagation:
(“capturing” phase) occurs before the target handlers are invoked.
target handlers invoked.
(“bubbling” phase) event bubbling.
most events bubble up to the Document object, and then to the Window object, notable exceptions are the “focus” “blur,” and “scroll” events.
a handler can stop the event from bubbling by calling event.stopPropagation().
The capturing phase is like the bubbling phase in reverse.
capturing handlers of the Window object are invoked first.
then the capturing handlers of the Document object, and so on.
⚠️ event target's capturing handlers are NOT invoked.
bubbling phase
hide or not to hide?
stop propagation
JavaScript The Definitive Guide (15.2 Events)
Window
Document
Element
register handler