Event delegation - mmedrano9438/peripheral-brain GitHub Wiki
Event Delegation is a pattern based upon the concept of [Event Bubbling]. It is an event-handling pattern that allows you to handle events at a higher level in the DOM tree other than the level where the event was first received.
HTML elements receive different types of events, from click, to blur, to scroll, and so on.
One behavior these events have in common is Event Bubbling.
- An event doesn't stop at the direct element that receives it. The event bubbles up to its ancestors, until it gets to the root element. Basically when u click the button you're also clicking the span and div elements.