JS Coding Questions Logo
JS Coding Questions
#462💼 Interview

What are the event phases of a browser?

Advertisement

728x90

There are 3 phases in the lifecycle of an event propagation in JavaScript,

1. Capturing phase: This phase goes down gradually from the top of the DOM tree to the target element when a nested element clicked. Before the click event reaching the final destination element, the click event of each parent's element must be triggered.

2. Target phase: This is the phase where the event originally occurred reached the target element .

3. Bubbling phase: This is reverse of the capturing phase. In this pase, the event bubbles up from the target element through it's parent element, an ancestor and goes all the way to the global window object.

The pictorial representation of these 3 event phases in DOM looks like below,

Screenshot

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 34

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
462of476