aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/event/stoppropagation
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/event/stoppropagation
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/event/stoppropagation')
-rw-r--r--files/zh-cn/web/api/event/stoppropagation/index.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/event/stoppropagation/index.html b/files/zh-cn/web/api/event/stoppropagation/index.html
new file mode 100644
index 0000000000..f494423b47
--- /dev/null
+++ b/files/zh-cn/web/api/event/stoppropagation/index.html
@@ -0,0 +1,80 @@
+---
+title: event.stopPropagation
+slug: Web/API/Event/stopPropagation
+tags:
+ - API
+ - DOM
+ - Event
+ - stopPropagation
+ - 事件
+ - 方法
+ - 阻止冒泡事件
+translation_of: Web/API/Event/stopPropagation
+---
+<p>{{APIRef("DOM")}}</p>
+
+<p>阻止捕获和冒泡阶段中当前事件的进一步传播。 </p>
+
+<p>但是,它不能防止任何默认行为的发生; 例如,对链接的点击仍会被处理。</p>
+
+<p>如果要停止这些行为,请参见 <a href="/zh-cn/DOM/event.preventDefault" title="zh-cn/DOM/event.preventDefault">preventDefault</a> 方法,它可以阻止事件触发后默认动作的发生。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="eval notranslate"><em>event</em>.stopPropagation();
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<p>None.</p>
+
+<h3 id="返回值">返回值</h3>
+
+<p>undefined.</p>
+
+<h2 id="Example" name="Example">例子</h2>
+
+<p>查看示例5: <a href="/zh-cn/Gecko_DOM_Reference/Examples#Example_5:_Event_Propagation" title="zh-cn/Gecko_DOM_Reference/Examples#Example_5:_Event_Propagation">事件传播</a> 在示例一章中有关此方法和事件在DOM中传播的更详细示例。</p>
+
+<h2 id="Notes" name="Notes">备注</h2>
+
+<p>查看 <a class="external" href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-capture">DOM 规范</a> 中关于事件流的解释。 ( <a class="external" href="http://www.w3.org/TR/DOM-Level-3-Events/#event-flow" title="http://www.w3.org/TR/DOM-Level-3-Events/#event-flow">DOM Level 3 事件草案</a> 有案例可参考。)</p>
+
+<p><a href="/zh-cn/DOM/event.preventDefault" title="zh-cn/DOM/event.preventDefault">preventDefault</a> 是另外一个相关的方法,它可以阻止事件触发后默认动作的发生。</p>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th>规范</th>
+ <th>状态</th>
+ <th>说明</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM4", "#dom-event-stoppropagation", "Event.stopPropagation()")}}</td>
+ <td>{{Spec2("DOM4")}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM3 Events", "#widl-Event-stopPropagation", "Event.stopPropagation()")}}</td>
+ <td>{{Spec2("DOM3 Events")}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM2 Events", "#Events-Event-stopPropagation", "Event.stopPropagation()")}}</td>
+ <td>{{Spec2("DOM2 Events")}}</td>
+ <td>初始定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性" style="margin-bottom: 20px; line-height: 30px; font-size: 2.14285714285714rem;">浏览器兼容性</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("api.Event.stopPropagation")}}</p>
+
+<div id="compat-desktop"></div>