stopPropagation() 方法在 事件 接口在捕获和冒泡阶段阻止当前事件的进一步传播。无论如何,它不阻止任何默认行为的发生;例如,点击链接仍被处理。若想要停止这些行为,见 preventDefault() 方法。

句法

event.stopPropagation();
					

参数

None.

返回值

undefined .

范例

见范例 5: 事件传播 in the Examples chapter for a more detailed example of this method and event propagation in the DOM.

规范

规范 状态 注释
DOM
在该规范中的 Event.stopPropagation() 定义。
实时标准
DOM4
在该规范中的 Event.stopPropagation() 定义。
过时
DOM (文档对象模型) 2 级事件规范
在该规范中的 Event.stopPropagation() 定义。
过时 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
stopPropagation Chrome 1 Edge 12 Firefox 1 IE 9 Opera 7 Safari 1 WebView Android 1 Chrome Android 18 Firefox Android 4 Opera Android 10.1 Safari iOS 1 Samsung Internet Android 1.0

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: