XML DOM bubbles-eigenschap
Definitie en gebruik
De bubbles-eigenschap van het event retourneert een booleaanse waarde, als het event een bubbende soort is, dan retourneert het true, anders false.
Syntax
event.bubbles
Gebeurtenisverspreiding
In de 2e DOM, wordt het eventueel verspreiden van gebeurtenissen in drie stappen verdeeld:
Second, the bubbling phase. In this phase, the event will propagate back to or bubble back from the target element to the parent elements. Document objectPassing down 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.
Second, the phase occurs at the target node itself. Directly registering an event handler suitable for the target will run. This is similar to the event handling method provided by the 0-level event model.
First, the capture phase. Events start 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 tell if the event is a bubbling event.</p>
</body>
</html>
Try It Yourself (TIY)
- Bubbling event
- Check if the event is a bubbling event (Internet Explorer browser does not support).