32. Event Bubbling and Capturing

In This Chapter

  • Learn how events travel through the DOM

  • Understand the differences between event capturing and event bubbling

  • Interrupt events

In the previous chapter, you learned how to use the addEventListener function to listen for events that you want to react to. That chapter covered the basics, but it glossed over an important detail about how events actually get fired. An event isn’t an isolated disturbance. Like a butterfly flapping its wings, an earthquake, a meteor strike, or a Godzilla visit, many events ripple and affect a bunch of elements that lie in their path.

In this article, I will put on my investigative glasses, a top hat, and a serious British accent to explain what exactly happens ...

Get JavaScript Absolute Beginner's Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.