Event.bubbles
The bubbles read-only property of the Event interface indicates whether the event bubbles up through the DOM or not.
Note: See Event bubbling and capture for more information on bubbling.
Syntax
var doesItBubble = event.bubbles;
Value
A boolean value, which is true if the event bubbles up through the DOM.
Example
function handleInput(e) { // Checks whether the event bubbles and ... if (!e.bubbles) { // ... passes the event along if does 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.
Specifications
| Specification |
|---|
| DOM Standard (DOM) # ref-for-dom-event-bubbles③ |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
bubbles |
1 |
12 |
1.5 |
9 |
≤12.1 |
≤4 |
≤37 |
18 |
4 |
≤12.1 |
≤3 |
1.0 |
See also
-
stopPropagation()to prevent further propagation of the current event in the capturing and bubbling phases -
stopImmediatePropagation()to not call any further listeners for the same event at the same level in the DOM -
preventDefault()to allow propagation to continue but to disallow the browser to perform its default action should no listeners handle the event
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles