Event delegation
Event delegation is an event-handling technique in which an ancestor handles events from descendant elements through event propagation.
Secrets of the JavaScript Ninja, Second Edition
An event-handling pattern in which a parent or ancestor element handles events for descendant elements by relying on propagation.
- How it is used
- Replaces repeated click handlers on table cells with one handler on their ancestor table.
- How deep it goes
- Explains bubbling, ancestor placement, and the difference between event.target and this through DOM click examples.
- Examples
- Contrasts per-cell listeners with a table handler that colors clicked cells, and uses nested elements to show propagation.
- What you can do after
- Apply it via addEventListener to handle descendant clicks at an ancestor while distinguishing the clicked target from the handler element.
Read how Secrets of the JavaScript Ninja, Second Edition explains event delegation →
Vanilla Web
An event-handling technique that registers a listener on an ancestor and identifies relevant descendant interactions from the event.
- How it is used
- Handles repeated controls through a container listener to reduce listener overhead.
- How deep it goes
- Explains bubbling and target/currentTarget with a logging example, but stops short of a complete child-interaction filter.
- Examples
- Uses a customer list with 1,000 items and a smaller <ul> example that logs click targets.
- What you can do after
- Apply it via addEventListener to handle repeated controls with one container listener while checking the event target.
Also covered in
- Acing the Frontend InterviewIn early access (MEAP)
- Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
What to know first
- Document Object ModelThe Document Object Model is a platform-independent programming interface that represents a document as a structured tree of nodes and provides ways to access and modify its content and structure.
- eventA software event is an occurrence, state change, or notification that a system can detect, record, communicate, or handle.
- performancePerformance is a measure of how effectively a person, process, model, or system achieves its objectives, including qualities such as output quality, speed, and resource efficiency.
Related concepts
- event bubblinguses · Event bubbling is DOM event propagation in which an event travels from its target through successive ancestor nodes.
- handleruses · A handler is a software routine or component invoked to process an event, request, message, or other input.
- bubble phaseuses · The bubble phase is the event-propagation stage in which an event travels from its target through ancestor elements.
- event targetuses · An event target is an object or node associated with an event as its origin or recipient during event dispatch.
- template literalused by · A JavaScript string literal delimited by backticks that supports multiline text and embedded expressions.
Questions about event delegation
What is event delegation?
Event delegation is an event-handling technique in which an ancestor handles events from descendant elements through event propagation.
Which Manning books explain event delegation?
Secrets of the JavaScript Ninja, Second Edition and Vanilla Web.
What should I know before learning event delegation?
Manning books that teach event delegation usually introduce Document Object Model, event and performance first.
What is the difference between event delegation and non-bubbling event?
Event delegation is an event-handling technique in which an ancestor handles events from descendant elements through event propagation. A non-bubbling event is a DOM event whose propagation does not continue from its target to ancestor elements.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

