The Event
property bubbles
indicates whether the event bubbles up through the DOM or not.
Note: See Event bubbling and capture for more information on bubbling.
var doesItBubble = Event.bubbles;
A Boolean
, which is true
if the event bubbles up through the DOM.
function goInput(e) { // checks bubbles and if (!e.bubbles) { // passes event along if it's not passItOn(e); } // already bubbling doOutput(e) }
Note: Only certain events can bubble. Events that do bubble have this property set to true
. You can use this property to check if an event is allowed to bubble or not.
Specification | Status | Comment |
---|---|---|
DOM The definition of 'Event.bubbles' in that specification. | Living Standard | |
Document Object Model (DOM) Level 2 Events Specification The definition of 'Event.bubbles' in that specification. | Obsolete | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 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 | ? | ? |
stopPropagation()
to stop bubbling the eventstopImmediatePropagation()
to not call any further listeners for the same event at the same level in the DOMpreventDefault()
to allow propagation to continue but to disallow the browser to perform its default action should no listeners handle the event
© 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/bubbles