In JavaScript, the cancelBubble property of the Event interface is a deprecated boolean. Setting it to true before returning from a handler prevents further propagation (MDN).
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use event.cancelBubble. Start with this line.
JavaScript
event.cancelBubble = true;
Call
What it does
event.cancelBubble = true;
Primary signature.
Built into the browser. Read event.cancelBubble on an Event instance — no import required.
Library declarations
JavaScript
event.cancelBubble = true;
Parameters
Parameter
Description
stopPropagation()
Required. Modern equivalent
cancelBubble = false
Optional. No effect in later engines
Return Value
Return Value
Description
*
The current value of event.cancelBubble.
JavaScript Examples
Example 1 — Legacy cancelBubble = true
MDN pattern you may still see in old onclick handlers.
Retest parent/child clicks to confirm the same stop behavior.
Compatibility
Browser Support
Event.cancelBubble is marked Deprecated on MDN. Engines still implement it for compatibility, but new code should use stopPropagation(). Also available in Web Workers (still deprecated).
✓ Deprecated
Event.cancelBubble
Legacy boolean stop flag — migrate to Event.stopPropagation().
LegacyDeprecated
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
cancelBubblePrefer stopPropagation
Bottom line: Supported for compatibility, not for new APIs. Prefer event.stopPropagation(). See the MDN cancelBubble reference.
Frequently Asked Questions
It is a deprecated boolean on Event. Setting it to true before returning from a handler prevents further propagation. Prefer Event.stopPropagation() in new code (MDN).
MDN marks Event.cancelBubble as Deprecated. It is not Experimental or Non-standard, but avoid it in new projects and migrate legacy code to stopPropagation().
Call event.stopPropagation() to stop further capturing and bubbling. Use event.stopImmediatePropagation() if you also need to skip remaining listeners on the same target.
MDN notes that in later implementations, setting cancelBubble to false does nothing. Only setting true was meaningful for stopping propagation.
No. cancelable says whether preventDefault() can block the default action. cancelBubble (legacy) stops propagation. They solve different problems.
Yes. MDN notes it is available in Web Workers, but it remains deprecated there too — prefer stopPropagation().