Open In App

Difference between Event Bubling & Event Capturing ?

Last Updated : 16 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Event Bubbling

Event bubbling is the default behavior in which an event triggered on a nested element propagates up through its ancestors in the DOM hierarchy, allowing each ancestor to respond to the event.

Event Capturing

Event capturing is the opposite of event bubbling, where the event is captured on the outermost ancestor first, and then it propagates down to the target element, enabling the outer elements to capture the event before reaching the target.

Difference between Event Bubbling and Event Capturing:

Criteria

Event Bubbling

Event Capturing

Order of Execution

Bottom-up, from target to the root (ancestors)

Top-down, from root (document) to the target element

Default Behavior

Enabled by default

Not enabled by default; must be explicitly set in event registration

Event Flow Direction

Bubbles upward through the DOM hierarchy

Captures events on the way down to the target

DOM Method

Uses the addEventListener method with the default false parameter

Uses the addEventListener method with the true parameter


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads