JS Built-ins
Eventbeginner

Event β€” stopPropagation is a function

πŸ“– Usage Example
const e = new Event('x')
e.stopImmediatePropagation()  // stops all remaining listeners on the same target

stopImmediatePropagation() prevents other listeners on the same element from running.

Event.stopPropagation

stopPropagation() prevents the event from bubbling up the DOM tree after the current listener runs.

Challenge: Verify that typeof new Event('x').stopPropagation is 'function'.

πŸ’‘ Hints (1)
  • β€’ stopPropagation stops bubbling but does not prevent other listeners on the same element