XML DOM bubbles event property

Definition and usage

The bubbles event property returns a boolean value, if the event is a bubbling type, it returns true, otherwise it returns false.

Syntax

event.bubbles

Event propagation

In the 2-level DOM, event propagation is divided into three stages:

Second, the bubbling phase. In this phase, events will propagate from the target element up to or bubble back Document objectpassed down along the document tree to the target node. If any of the target's ancestors have specifically registered a capture event handler, then these handlers will run during the event propagation process.

The second phase occurs on the target node itself. Event handlers directly registered on the target will run. This is similar to the event handling method provided by the 0-level event model.

First, the capture phase. Events are propagated from Document objectof the document hierarchy.

Example

The following example can detect whether the event that occurs is a bubbling event:

<html>
<head>
<script type="text/javascript">
function getEventType(event)
  { 
  alert(event.bubbles);
  }
</script>
</head>
<body onmousedown="getEventType(event)">
<p>Click somewhere in the document. 
An alert box will inform if the event is a bubbling event.</p>
</body>
</html>

Try It Yourself (TIY)

Bubbling event
Check if the event is a bubbling event (IE browser does not support).