aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn
diff options
context:
space:
mode:
authorallo <yin199909@aliyun.com>2022-03-10 14:42:17 +0800
committerIrvin <irvinfly@gmail.com>2022-03-15 21:33:26 +0800
commit3803b428d0be4cb1ef0e729f66e9f7478a69220c (patch)
tree9d769610abd85e928957a79fa6a3d63530173703 /files/zh-cn
parent257b8d6542ffea0bc815470aa50c1b68fb34dff9 (diff)
downloadtranslated-content-3803b428d0be4cb1ef0e729f66e9f7478a69220c.tar.gz
translated-content-3803b428d0be4cb1ef0e729f66e9f7478a69220c.tar.bz2
translated-content-3803b428d0be4cb1ef0e729f66e9f7478a69220c.zip
convert to md and sync with english version
Diffstat (limited to 'files/zh-cn')
-rw-r--r--files/zh-cn/web/api/event/stoppropagation/index.md66
1 files changed, 16 insertions, 50 deletions
diff --git a/files/zh-cn/web/api/event/stoppropagation/index.md b/files/zh-cn/web/api/event/stoppropagation/index.md
index b769c50a6e..ec0e4ef6fb 100644
--- a/files/zh-cn/web/api/event/stoppropagation/index.md
+++ b/files/zh-cn/web/api/event/stoppropagation/index.md
@@ -11,66 +11,32 @@ tags:
- 阻止冒泡事件
translation_of: Web/API/Event/stopPropagation
---
-<p>{{APIRef("DOM")}}</p>
+{{APIRef("DOM")}}
-<p>阻止捕获和冒泡阶段中当前事件的进一步传播。 </p>
+{{domxref("Event")}} 接口的 **`stopPropagation()`** 方法阻止捕获和冒泡阶段中当前事件的进一步传播。但是,它不能防止任何默认行为的发生;例如,对链接的点击仍会被处理。如果要停止这些行为,请参见 {{domxref("Event.preventDefault", "preventDefault()")}} 方法,它可以阻止事件触发后默认动作的发生。它也不能阻止附加到相同元素的相同事件类型的其它事件处理器,如果要阻止这些处理器的运行,请参见 {{domxref("Event.stopImmediatePropagation", "stopImmediatePropagation()")}} 方法。
-<p>但是,它不能防止任何默认行为的发生; 例如,对链接的点击仍会被处理。</p>
+## 语法
-<p>如果要停止这些行为,请参见 <a href="/zh-cn/DOM/event.preventDefault" title="zh-cn/DOM/event.preventDefault">preventDefault</a> 方法,它可以阻止事件触发后默认动作的发生。</p>
+```js
+event.stopPropagation();
+```
-<h2 id="Syntax" name="Syntax">语法</h2>
+### 参数
-<pre class="eval notranslate"><em>event</em>.stopPropagation();
-</pre>
+None.
-<h3 id="参数">参数</h3>
+### 返回值
-<p>None.</p>
+None.
-<h3 id="返回值">返回值</h3>
+## 示例
-<p>undefined.</p>
+参见[冒泡事件](/zh-CN/docs/Web/API/Document_Object_Model/Examples#example_5_event_propagation)。
-<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>
+{{Specifications}}
-<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>
-
-<p>{{Compat("api.Event.stopPropagation")}}</p>
-
-<div id="compat-desktop"></div>
+{{Compat}}