The Event.cancelBubble property is a historical alias to Event.stopPropagation(). Setting its value to true before returning from an event handler prevents propagation of the event. In later implementations, setting this to false does nothing. See Browser compatibility for details. 

Syntax

event.cancelBubble = bool;
var bool = event.cancelBubble;

Example

elem.onclick = function(e) {
 // do cool things here
  e.cancelBubble = true;
}

Specifications

Specification Status Comment
DOM
The definition of 'cancelBubble' in that specification.
Living Standard  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes1 Yes532 Yes Yes1 Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes1 Yes1 Yes532 Yes1 Yes ?

1. Starting with Chrome 58 and Opera 45, setting this property to false does nothing, as per spec discussion.

2. Prior to Firefox 53, this property was defined on the UIEvent interface. See bug 1298970 for more details.

Document Tags and Contributors

Last updated by: fscholz,