Event:bubbles 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
值
一个布尔值,若事件沿 DOM 树向上冒泡,则该属性为 true
。
示例
js
function handleInput(e) {
// 检查事件是否沿冒泡阶段传播
if (!e.bubbles) {
passItOn(e);
}
// 已经冒泡
doOutput(e);
}
规范
Specification |
---|
DOM # ref-for-dom-event-bubbles③ |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bubbles |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- See implementation notes.
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.
参见
stopPropagation()
方法用于阻止当前事件在捕获和冒泡阶段的进一步传播stopImmediatePropagation()
方法用于阻止在同一 DOM 层级上针对同一事件调用任何后续监听器preventDefault()
方法用于在事件继续传播的同时,禁止浏览器在无监听器处理该事件时执行其默认操作