The bubbles
read-only property of the Event
interface indicates whether the event bubbles up through the DOM or not.
Note: See [[../../../../Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture|Event bubbling and capture]] for more information on bubbling.
Syntax
var doesItBubble = event.bubbles;
Value
A Boolean
, 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 | Status | Comment |
---|---|---|
DOMThe definition of 'Event.bubbles' in that specification. | Living Standard | |
Document Object Model (DOM) Level 2 Events SpecificationThe definition of 'Event.bubbles' in that specification. | Obsolete | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
bubbles
|
Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
See also
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
Event.bubbles by Mozilla Contributors is licensed under CC-BY-SA 2.5.