DOM Event Propagation,Three types of event listeners:DOM Event Propagation,Three types of event listeners:Capturing: Listener on ancestor created with trueas third arg.DOM Event Propagation,Three types of event listeners:Target: Listener on target element
16DOM Event Propagation,Three types of event listeners:Bubbling: Listener on ancestor created with falseas third arg.DOM Event Propagation,Priority of event handlers:bodyollia1.Capturing eventhandlers; ancestorsclosest to roothave highest priorityTargetDOM Event Propagation,Priority of event handlers:bodyollia2. Target event handlersDOM Event Propagation,Priority of event handlers:bodyollia3. Bubbling eventhandlers; ancestorsclosest to target havepriority.
17DOM Event Propagation,Certain events do not bubble, e.g.,–load–unload–focus–blurDOM Event Propagation,Propagation-related propertiesof Eventinstances:–eventPhase: represents event processing phase:,1: capturing (rarely used, not default for event handlers),2: target,3: bubbling–currentTarget: object (ancestor or target) associated with this event handlerDOM Event Propagation,Propagation-related method of Eventinstances:–stopPropagation(): lower priority event handlers will not be called,Typical design:–Use bubblingevent handlers to provide defaultprocessing (may be stopped)–Use capturingevent handlers to provide requiredprocessing Event Propagation