aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/event/cancelbubble/index.html
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
commit310fd066e91f454b990372ffa30e803cc8120975 (patch)
treed5d900deb656a5da18e0b60d00f0db73f3a2e88e /files/zh-cn/web/api/event/cancelbubble/index.html
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.gz
translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.bz2
translated-content-310fd066e91f454b990372ffa30e803cc8120975.zip
unslug zh-cn: move
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>