Event Bubbling & Delegation Playground

One listener on ul.list, and the teacher reads every note that climbs from a pupil’s desk: pick e.target, e.currentTarget or closest(), then see what happens…

Why it matters

Delegation = one listener for hundreds of items (and items that do not exist yet), less memory, and no listener left behind. React itself puts its listeners on the app root this way. But there are three traps: e.target can be an element too deep, a stopPropagation() on the way cuts it off, and some events do not bubble.

The key idea

Events climb from the target to the root, so one listener up top can handle them all

Common mistakes

Try it in this playground