aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/event/cancelbubble/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/event/cancelbubble/index.html')
-rw-r--r--files/zh-cn/web/api/event/cancelbubble/index.html93
1 files changed, 93 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/event/cancelbubble/index.html b/files/zh-cn/web/api/event/cancelbubble/index.html
new file mode 100644
index 0000000000..c228d329d6
--- /dev/null
+++ b/files/zh-cn/web/api/event/cancelbubble/index.html
@@ -0,0 +1,93 @@
+---
+title: Event.cancelBubble
+slug: Web/API/Event/禁用时间冒泡
+tags:
+ - 事件
+translation_of: Web/API/Event/cancelBubble
+---
+<p>{{APIRef("DOM Events")}} </p>
+
+<p><code><strong>Event.cancelBubble</strong></code> 属性是 {{domxref("Event.stopPropagation()")}}的一个曾用名。在从事件处理程序返回之前将其值设置为true可阻止事件的传播。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox">event.cancelBubble = <em>bool;</em>
+<em>let bool</em> = event.cancelBubble;</pre>
+
+<h2 id="用例">用例</h2>
+
+<dl>
+ <dt>
+ <pre class="syntaxbox">ele.onclick = function(e) {
+ // 在这儿可以做点儿有趣的事情
+  e.cancelBubble = true;
+}</pre>
+ </dt>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<p><em>这个属性的规范并未统一.</em> 因为他还有其他标准 W3C版: <a href="http://www.w3.org/TR/1999/WD-DOM-Level-2-19990304/events.html#attribute-cancelBubble">an old Working Draft of W3C DOM Level 2</a>. 微软版: <a href="https://msdn.microsoft.com/en-us/library/ms533545(v=vs.85).aspx">description of it on MSDN</a>.</p>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Firefox (Gecko)</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Internet Explorer</th>
+ <th>Microsoft Edge</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>Android</th>
+ <th>Edge</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="参考">参考</h2>
+
+<ul>
+ <li>{{domxref("UIEvent.cancelBubble")}}</li>
+ <li>translated by cnvoid</li>
+</ul>