foundation
DOM
Document tree structure, event propagation, event delegation, custom events, and DOM mutation costs.
DOM interviews test whether you understand the live document graph, how events travel, and how mutations affect later rendering work. Answers should connect querying, traversal, listeners, and mutation cost.
Subtopics: DOM tree structure, event propagation, event delegation, and custom events.
On interviews: walk through capture and bubble order, when delegation beats many listeners, and how CustomEvent decouples components.
Common pitfalls: confusing HTML source with the live DOM, unsafe innerHTML, and stopPropagation that breaks composition.
The trade-off is convenience versus control — pick the mechanism that matches your coupling and performance budget.
Checklist:
- Know nodes, elements, attributes, and properties.
- Explain propagation phases and delegation.
- Batch DOM mutations when possible.
- Treat custom events as notifications, not state.