Event.bubbles - Web APIs 编辑
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
, 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 |
---|---|---|
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. |
Browser compatibility
BCD tables only load in the browser
See also
stopPropagation()
to prevent further propagation of the current event in the capturing and bubbling phasesstopImmediatePropagation()
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论