Browser events: bubbling, capturing, and delegation
Legend has it that back in the day, Netscape Navigator and Internet Explorer had different, incompatible ways of propagating events to multiple handlers; Netscape “captured” while Internet Explorer “bubbled.” So the W3C decided to standardize both behaviors when they createdaddEventListener, which can be configured to use either model. Let’s take a look at how these models play into the “event delegation” model used by modern web frameworks. Suppose you have this HTML structure: <body> <p> <a><span>Hello</span></a> </p> </body> If we add a “click” event listener to the A, we’d expect it to fire when the user clicks the SPAN. We’d also expect clicking on theRead More →