Interview Question

What is event bubbling?

Bubbling moves a bubbling event from its target through ancestors.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

Event bubbling is the phase where an event is delivered from the target toward ancestors. • Only events whose bubbles flag is true bubble. • Ancestor listeners can observe the event during this phase. • stopPropagation prevents further propagation but does not undo completed listeners.

Example

Code
list.addEventListener('click', event => {
  console.log(event.target);
});

Quick Revision

Bubbling moves a bubbling event from its target through ancestors.