aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/uievent/index.html
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/uievent/index.html
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/uievent/index.html')
-rw-r--r--files/zh-cn/web/api/uievent/index.html192
1 files changed, 192 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/uievent/index.html b/files/zh-cn/web/api/uievent/index.html
new file mode 100644
index 0000000000..afad06a4e3
--- /dev/null
+++ b/files/zh-cn/web/api/uievent/index.html
@@ -0,0 +1,192 @@
+---
+title: UIEvent
+slug: Web/API/UIEvent
+tags:
+ - API
+ - DOM
+ - Event
+ - Reference
+ - UIEvent
+translation_of: Web/API/UIEvent
+---
+<p>{{APIRef("DOM Events")}}</p>
+
+<p> <code>UIEvent</code> 接口表示简单的用户界面事件。</p>
+
+<p><code>UIEvent</code> 是从 {{domxref("Event")}} 派生出来的。尽管 {{domxref("UIEvent.initUIEvent()")}} 方法为了向后兼容而一直保留着,但是你应该使用 {{domxref("UIEvent.UIEvent", "UIEvent()")}} 构造器来创建 <code>UIEvent</code> 对象。</p>
+
+<p>某些接口是这个的直接或间接后代:{{domxref("MouseEvent")}}, {{domxref("TouchEvent")}}, {{domxref("FocusEvent")}}, {{domxref("KeyboardEvent")}}, {{domxref("WheelEvent")}}, {{domxref("InputEvent")}}, 和{{domxref("CompositionEvent")}}.</p>
+
+<h2 id="Constructors">Constructors</h2>
+
+<dl>
+ <dt>{{domxref("UIEvent.UIEvent()", "UIEvent()")}}</dt>
+ <dd>创建一个 <code>UIEvent</code> 对象</dd>
+</dl>
+
+<h2 id="属性">属性</h2>
+
+<p><em>也继承了父代 {{domxref("Event")}} 的一些属性。</em></p>
+
+<dl>
+ <dt>{{domxref("UIEvent.cancelBubble")}} {{Non-standard_inline}} {{Deprecated_inline}}</dt>
+ <dd>返回一个 {{jsxref("Boolean")}},表示该事件的冒泡是否被取消。</dd>
+</dl>
+
+<dl>
+ <dt>{{domxref("UIEvent.detail")}}{{readonlyinline}}</dt>
+ <dd>Returns a <code>long</code> with details about the event, depending on the event type.</dd>
+ <dt>{{domxref("UIEvent.isChar")}} {{obsolete_inline}} {{readonlyinline}}</dt>
+ <dd>返回一个 {{jsxref("Boolean")}},表示该事件是否产生了一个键盘字符(key character)。</dd>
+ <dt>{{domxref("UIEvent.layerX")}} {{Non-standard_inline}} {{readonlyinline}}</dt>
+ <dd>返回事件相对于当前层的水平坐标。</dd>
+ <dt>{{domxref("UIEvent.layerY")}} {{Non-standard_inline}} {{readonlyinline}}</dt>
+ <dd>返回事件相对于当前层的垂直坐标。</dd>
+ <dt>{{domxref("UIEvent.pageX")}} {{Non-standard_inline}} {{readonlyinline}}</dt>
+ <dd>返回事件相对于整个文档的水平坐标。</dd>
+ <dt>{{domxref("UIEvent.pageY")}} {{Non-standard_inline}} {{readonlyinline}}</dt>
+ <dd>返回事件相对于整个文档的垂直坐标。</dd>
+ <dt>{{domxref("UIEvent.sourceCapabilities")}} {{non-standard_inline}} {{readonlyinline}}</dt>
+ <dd>返回输入设备功能接口的一个实例,它提供有关负责生成 touch 事件的物理设备的信息。</dd>
+ <dt>{{domxref("UIEvent.view")}}{{readonlyinline}}</dt>
+ <dd>返回一个包含了产生该事件的视图的 {{domxref("WindowProxy")}} 。</dd>
+ <dt>{{domxref("UIEvent.which")}} {{Non-standard_inline}} {{readonlyinline}} </dt>
+ <dd>返回一个对应(键盘)按下的数字类型的 <code>keyCode</code> ,或者一个字母数字键按下时的字符码(<code>charCode</code>)。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p><em>也继承了父代 {{domxref("Event")}} 的一些方法。</em></p>
+
+<dl>
+ <dt>{{domxref("UIEvent.initUIEvent()")}} {{deprecated_inline}}</dt>
+ <dd>初始化一个 <code>UIEvent</code> 对象。如果事件已经被分派,这个方法什么都不做。</dd>
+</dl>
+
+<h2 class="editable" id="规范"><span>规范</span></h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('InputDeviceCapabilities')}}</td>
+ <td>{{Spec2('InputDeviceCapabilities')}}</td>
+ <td>Added <code>sourceCapabilities</code> property.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM3 Events', '#interface-UIEvent', 'UIEvent')}}</td>
+ <td>{{Spec2('DOM3 Events')}}</td>
+ <td>Added the <code>UIEvent()</code> constructor, deprecated the <code>initUIEvent()</code> method and changed the type of <code>view</code>from <code>AbstractView</code> to <code>WindowProxy</code>.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Events', '#Events-UIEvent', 'UIEvent')}}</td>
+ <td>{{Spec2('DOM2 Events')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}<sup>[2]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>UIEvent()</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop(11)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>cancelBubble</code> defined on Event</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop(53)}}<sup>[1]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}<sup>[2]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>UIEvent()</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile(11)}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>cancelBubble</code> defined on Event</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile(53)}}<sup>[1]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] From Firefox 52, this property is now defined on the {{domxref("Event")}} interface instead. See {{bug(1298970)}} for more details.</p>
+
+<p>[2] The {{domxref("UIEvent.isChar", "isChar")}} property has never been supported by any browser but Firefox, and even on Firefox it's never worked except on Mac OSX. For that reason, it's been removed in Firefox 55 to align with other browsers.</p>
+
+<h2 class="editable" id="相关链接"><span>相关链接</span></h2>
+
+<ul>
+ <li><a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events">Introduction to events</a></li>
+ <li>{{domxref("Event")}}</li>
+</ul>