nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

javascript/Events

How the browser decides which handler runs first when one click hits three nested elements.

10 QuestionsIntermediateMedium Priority ~11 min read

When something happens in the DOM — a click, a keypress, a scroll — the browser doesn't just fire a handler on the exact element it happened on. It runs a three-phase process: capturing (from the root down to the target), the target phase, and bubbling (back up from the target to the root). Handlers attached normally listen during the bubbling phase by default; passing { capture: true } listens during the capturing phase instead.

This is what makes event.stopPropagation() and event delegation possible. Delegation takes advantage of bubbling by attaching one listener to a parent element instead of many listeners to individual children, then using event.target to figure out which child was actually interacted with — a pattern that scales much better for dynamic lists than attaching and removing listeners on every item. event.preventDefault(), by contrast, doesn't stop propagation at all — it only cancels the browser's default action (like a link navigating), which is a distinction that trips people up constantly.

What you'll walk away knowing

The three phases of DOM event flow: capturing, target, and bubbling
How event delegation works, and why it's more efficient than per-element listeners
The real difference between stopPropagation() and preventDefault() — they solve different problems
What stopImmediatePropagation() does differently from stopPropagation() when multiple listeners exist on one element

No questions match "".

All Topics
1
Basics
Data Types
Functions
Objects
2
Engine
JIT
V8
Event Loop and Runtime
Concurrency and Threading
Bytecode and Parsing
Execution Context
Garbage Collector
3
this
Call Apply Bind
Closure
Error Handling
4
String Operations
Array Operations
Iterator and Generator
Modules
5
Events
Promises
Web Workers
Web Sockets
6
Functional Programming
Currying
Higher Order Functions
Memoisation
7
ES6 Classes
ES6
PWA
Web Assembly
Browser APIS
8
Security
Code
Polyfills
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.