Can you describe a real world situation (non-contrived) in which one would manipulate event propagation or change a listener from being registered at the capturing vs. bubbling phase?
One example I heard in an interview once was something along the lines of: Imagine you had a page with a modal that appeared, what's one way you could capture whether or not the modal (or the area outside of it) was clicked? The answer the interviewer was looking for involved attaching one event listener to the page, and then using bubbling/event.target to determine if the modal or the area around it was clicked.
Similar to the bubbling example here: javascript.info/bubbling-and-capturing
TheSheriff
Co-Founder, Founder, Entrepreneur & Problem Solver
I guess there are cases that have nested listeners, so if you click on an element and wouldn't want it's parent elements to also be triggered then one would set the bubbling to false.
Why you would have nested listeners I don't know, but hey ho. Also check out the mozilla docs on addEventListener, it will provide some insight.