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.
event.cancelBubble = bool; var bool = event.cancelBubble;
elem.onclick = function(e) { // do cool things here e.cancelBubble = true; }
Specification | Status | Comment |
---|---|---|
DOM The definition of 'cancelBubble' in that specification. | Living Standard |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes
|
Yes | 53
|
Yes | Yes
|
Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes
|
Yes
|
Yes | 53
|
Yes
|
Yes | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelBubble