diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/uievent | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/uievent')
-rw-r--r-- | files/zh-cn/web/api/uievent/cancelbubble/index.html | 18 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/detail/index.html | 86 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/index.html | 192 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/ischar/index.html | 23 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/pagex/index.html | 105 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/pagey/index.html | 89 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/uievent/index.html | 71 | ||||
-rw-r--r-- | files/zh-cn/web/api/uievent/视图/index.html | 52 |
8 files changed, 636 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/uievent/cancelbubble/index.html b/files/zh-cn/web/api/uievent/cancelbubble/index.html new file mode 100644 index 0000000000..cc024ba8b6 --- /dev/null +++ b/files/zh-cn/web/api/uievent/cancelbubble/index.html @@ -0,0 +1,18 @@ +--- +title: event.cancelBubble +slug: Web/API/UIEvent/cancelBubble +translation_of: Web/API/UIEvent/cancelBubble +--- +<p>{{ ApiRef() }}</p> +<div class="warning"> + <strong>警告:</strong> 请使用 <a href="/zh-cn/DOM/event.stopPropagation" title="zh-cn/DOM/event.stopPropagation">event.stopPropagation()</a> 方法来代替该不标准的属性.</div> +<h3 id="Summary" name="Summary">概述</h3> +<p>{{ Deprecated_header() }} 获取或设置一个布尔值,表明当前事件是否要取消冒泡.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">event.cancelBubble = <em>bool;</em> +<em>var bool</em> = event.cancelBubble; +</pre> +<p><code>bool</code> 的值为<code>true或</code><code>false</code>.</p> +<h3 id="Notes" name="Notes">备注</h3> +<p><code>如果一个事件是可冒泡的,则它的cancelBubble</code>属性的默认值为 <code>false</code>,代表允许该事件向上冒泡. 将<code>cancelBubble</code>属性设置为<code>true以后,可以阻止该事件的进一步冒泡行为.</code></p> +<p>{{ languages( { "pl": "pl/DOM/event.cancelBubble" ,"en": "en/DOM/event.cancelBubble" } ) }}</p> diff --git a/files/zh-cn/web/api/uievent/detail/index.html b/files/zh-cn/web/api/uievent/detail/index.html new file mode 100644 index 0000000000..277f89be04 --- /dev/null +++ b/files/zh-cn/web/api/uievent/detail/index.html @@ -0,0 +1,86 @@ +--- +title: UIEvent.detail +slug: Web/API/UIEvent/detail +translation_of: Web/API/UIEvent/detail +--- +<p>{{APIRef("DOM Events")}}</p> + +<p><strong><code>UIEvent.detail是只读属性</code></strong>, 当值为非空的时候, 提供当前点击数(和环境有关) 。</p> + +<p>对 {{event("click")}} 或者 {{event("dblclick")}} 事件, <code>UIEvent.detail</code> 是当前点击数量。</p> + +<p>对 {{event("mousedown")}} 或者 {{event("mouseup")}} 事件, <code>UIEvent.detail是1加上当前点击数。</code></p> + +<p>对所有的其它{{domxref("UIEvent")}} 对象, <code>UIEvent.detail</code> 总是零.</p> + +<h2 id="Specifications">Specifications</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('DOM3 Events','#widl-UIEvent-detail','UIEvent.detail')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('DOM2 Events','#Events-UIEvent-detail','UIEvent.detail')}}</td> + <td>{{Spec2('DOM2 Events')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">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>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown()}}</td> + <td>{{CompatUnknown()}}</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>Firefox Mobile (Gecko)</th> + <th>Android</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>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + </tr> + </tbody> +</table> +</div> 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> diff --git a/files/zh-cn/web/api/uievent/ischar/index.html b/files/zh-cn/web/api/uievent/ischar/index.html new file mode 100644 index 0000000000..8d6097d123 --- /dev/null +++ b/files/zh-cn/web/api/uievent/ischar/index.html @@ -0,0 +1,23 @@ +--- +title: event.isChar +slug: Web/API/UIEvent/isChar +translation_of: Web/API/UIEvent/isChar +--- +<p>{{ ApiRef() }}</p> +<div class="warning"> + <strong>警告:</strong> 不要使用该属性,该属性有一个已知的bug,就是它始终返回<code>false</code>,从不返回<code>true</code>.查看<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=312552" title="https://bugzilla.mozilla.org/show_bug.cgi?id=312552">https://bugzilla.mozilla.org/show_bug.cgi?id=312552</a></div> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回一个布尔值,表明该事件是否是由一个字符按键触发的.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval">bool = event.isChar +</pre> +<h3 id="Example" name="Example">例子</h3> +<pre> if(e.isChar){ + echoInput(e.type); + } +</pre> +<h3 id="Notes" name="Notes">备注</h3> +<p>一些常用的组合键可能会触发键盘事件,但是不会产生任何字符(例如:CTRL + ALT + ?).在这种情况下,isChar返回false.isChar常用于判断用户在一个文本输入框内输入的是否为一个字符.</p> +<h3 id="Specification" name="Specification">规范</h3> +<p>不属于任何公开的规范</p> +<p>{{ languages( {"pl": "pl/DOM/event.isChar","en": "en/DOM/event.isChar" } ) }}</p> diff --git a/files/zh-cn/web/api/uievent/pagex/index.html b/files/zh-cn/web/api/uievent/pagex/index.html new file mode 100644 index 0000000000..b4a7f812f7 --- /dev/null +++ b/files/zh-cn/web/api/uievent/pagex/index.html @@ -0,0 +1,105 @@ +--- +title: UIEvent.pageX +slug: Web/API/UIEvent/pageX +translation_of: Web/API/UIEvent/pageX +--- +<p>{{APIRef("DOM Events")}} {{Non-standard_header}}</p> + +<p><code><strong>UIEvent.pageX</strong></code> 是只读属性,它返回相对于整个文档的水平坐标。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox">var <em>pos</em> = <em>event</em>.pageX</pre> + +<h2 id="Syntax" name="Syntax">示例</h2> + +<pre><em>var pageX</em> = <em>event</em>.pageX;</pre> + +<p><code><em>pageX</em></code> 是鼠标事件触发时,鼠标指针相对于整个文档 X 坐标上像素点的整数值。这一属性同时也参照了页面的水平滚动距离。</p> + +<pre class="brush: js"><html> +<head> +<title>pageX\pageY & layerX\layerY example</title> + +<script type="text/javascript"> + +function showCoords(evt){ + var form = document.forms.form_coords; + var parent_id = evt.target.parentNode.id; + form.parentId.value = parent_id; + form.pageXCoords.value = evt.pageX; + form.pageYCoords.value = evt.pageY; + form.layerXCoords.value = evt.layerX; + form.layerYCoords.value = evt.layerY; +} + +</script> + +<style type="text/css"> + + #d1 { + border: solid blue 1px; + padding: 20px; + } + + #d2 { + position: absolute; + top: 180px; + left: 80%; + right:auto; + width: 40%; + border: solid blue 1px; + padding: 20px; + } + + #d3 { + position: absolute; + top: 240px; + left: 20%; + width: 50%; + border: solid blue 1px; + padding: 10px; + } + +</style> +</head> + +<body onmousedown="showCoords(event)"> + +<p>To display the mouse coordinates please click anywhere on the page.</p> + +<div id="d1"> +<span>This is an un-positioned div so clicking it will return +layerX/layerY values almost the same as pageX/PageY values.</span> +</div> + +<div id="d2"> +<span>This is a positioned div so clicking it will return layerX/layerY +values that are relative to the top-left corner of this positioned +element. Note the pageX\pageY properties still return the +absolute position in the document, including page scrolling.</span> + +<span>Make the page scroll more! This is a positioned div so clicking it +will return layerX/layerY values that are relative to the top-left +corner of this positioned element. Note the pageX\pageY properties still +return the absolute position in the document, including page +scrolling.</span> +</div> + +<div id="d3"> +<form name="form_coords"> + Parent Element id: <input type="text" name="parentId" size="7" /><br /> + pageX:<input type="text" name="pageXCoords" size="7" /> + pageY:<input type="text" name="pageYCoords" size="7" /><br /> + layerX:<input type="text" name="layerXCoords" size="7" /> + layerY:<input type="text" name="layerYCoords" size="7" /> +</form> +</div> + +</body> +</html> +</pre> + +<h2 id="Specification" name="Specification">规范</h2> + +<p>这一属性不在规范中。</p> diff --git a/files/zh-cn/web/api/uievent/pagey/index.html b/files/zh-cn/web/api/uievent/pagey/index.html new file mode 100644 index 0000000000..6c504d3f52 --- /dev/null +++ b/files/zh-cn/web/api/uievent/pagey/index.html @@ -0,0 +1,89 @@ +--- +title: event.pageY +slug: Web/API/UIEvent/pageY +translation_of: Web/API/UIEvent/pageY +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">概述</h3> +<p>返回事件发生时相对于整个文档的纵坐标.</p> +<h3 id="Syntax" name="Syntax">语法</h3> +<pre class="eval"><em>var pageY</em> = <em>event</em>.pageY; +</pre> +<p><code>pageY</code> 是事件发生时鼠标指针所在位置相对于整个文档的纵坐标,单位为像素.该属性会考虑到页面滚动条的高度.</p> +<h3 id="Example" name="Example">例子</h3> +<pre><html> +<head> +<title>pageX\pageY & layerX\layerY example</title> + +<script type="text/javascript"> + +function showCoords(evt){ + var form = document.forms.form_coords; + var parent_id = evt.target.parentNode.id; + form.parentId.value = parent_id; + form.pageXCoords.value = evt.pageX; + form.pageYCoords.value = evt.pageY; + form.layerXCoords.value = evt.layerX; + form.layerYCoords.value = evt.layerY; +} + +</script> + +<style type="text/css"> + + #d1 { + border: solid blue 1px; + padding: 20px; + } + + #d2 { + position: absolute; + top: 180px; + left: 80%; + right:auto; + width: 40%; + border: solid blue 1px; + padding: 20px; + } + + #d3 { + position: absolute; + top: 240px; + left: 20%; + width: 50%; + border: solid blue 1px; + padding: 10px; + } + +</style> +</head> + +<body onmousedown="showCoords(event)"> + +<p>要显示鼠标所在位置的坐标,请点击页面上的任意地方.</p> + +<div id="d1"> +<span>这是一个未定位的div(没有指定css position属性),所以点击它返回的layerX/layerY值几乎和pageX/PageY值完全相同.</span> +</div> + +<div id="d2"> +<span><span id="result_box" lang="zh-CN"><span>这是一个</span><span>已定位的div</span><span>,因此</span><span>点击它</span><span>时返回</span><span>的layerX</span><span>/</span><span class="hps">layerY的值是相对于自己左上角(</span></span>top-left<span id="result_box" lang="zh-CN"><span class="hps">)位置的坐标值.</span> +<span>然而</span><span>pageX</span><span>/</span><span class="hps">pageY</span><span>属性</span><span>仍</span><span>返回该div在</span><span>文档中</span><span>的</span><span>绝对位置</span><span>,</span><span>包括页面</span><span>滚动</span></span>高度.</span> +</div> + +<div id="d3"> +<form name="form_coords"> + 父元素id: <input type="text" name="parentId" size="7" /><br /> + pageX:<input type="text" name="pageXCoords" size="7" /> + pageY:<input type="text" name="pageYCoords" size="7" /><br /> + layerX:<input type="text" name="layerXCoords" size="7" /> + layerY:<input type="text" name="layerYCoords" size="7" /> +</form> +</div> + +</body> +</html> +</pre> +<h3 id="Specification" name="Specification">规范</h3> +<p>不属于任何公开的标准.</p> +<p>{{ languages( {"pl": "pl/DOM/event.pageY","en": "en/DOM/event.pageY" } ) }}</p> diff --git a/files/zh-cn/web/api/uievent/uievent/index.html b/files/zh-cn/web/api/uievent/uievent/index.html new file mode 100644 index 0000000000..d80f3c7f0e --- /dev/null +++ b/files/zh-cn/web/api/uievent/uievent/index.html @@ -0,0 +1,71 @@ +--- +title: UIEvent() +slug: Web/API/UIEvent/UIEvent +translation_of: Web/API/UIEvent/UIEvent +--- +<div>{{APIRef("DOM Events")}}</div> + +<p><strong><code>UIEvent()</code></strong> 作为构造函数,可用于构造一个新的 {{domxref("UIEvent")}} 对象.</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><em>event</em> = new UIEvent(<em>typeArg</em> [, <em>UIEventInit</em>])</pre> + +<h3 id="Values">Values</h3> + +<dl> + <dt><code>typeArg</code></dt> + <dd>传递的是一个 {{domxref("DOMString")}}类型的字符串,用来命名且重新发布的事件。</dd> + <dt><code>UIEventInit</code> {{optional_inline}}</dt> +</dl> + +<dl> + <dd>是 <code>UIEventInit</code> 集合, 它拥有以下属性: + + <ul> + <li><strong><code>detail</code></strong>: 可选,默认为long类型的0数值, 用来标记事件的关联值. {{domxref("UIEvent.detail")}} 列出了标准事件的语义.</li> + <li><strong><code>view</code></strong>: 可选,默认为null,类型为 {{domxref("WindowProxy")}}, 用来关联{{domxref("Window")}} 与event本身.</li> + <li><strong><code>sourceCapabilities</code></strong>: {{non-standard_inline}} 一个 {{domxref("InputDeviceCapabilities")}} 类型的接口实例(对象),用来提供物理设备的触摸信息。</li> + </ul> + + <div class="note"> + <p><code>UIEventInit</code> 合集依然接受从{{domxref("Event.Event", "EventInit")}} 定义来的合集.</p> + </div> + </dd> +</dl> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table" style="height: 49px; width: 1000px;"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <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>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.UIEvent.UIEvent")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{domxref("UIEvent")}}, the interface of the objects it constructs.</li> +</ul> 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..66b72f2637 --- /dev/null +++ b/files/zh-cn/web/api/uievent/视图/index.html @@ -0,0 +1,52 @@ +--- +title: 用户界面项目视图 +slug: Web/API/UIEvent/视图 +tags: + - API + - DOM + - UI + - 参考 + - 只读 + - 属性 +translation_of: Web/API/UIEvent/view +--- +<p>{{APIRef("DOM Events")}}</p> + +<p>The <strong><code>UIEvent.view</code></strong> 只读属性返回的生成事件的 {{domxref("document.defaultView")}} (<code>window</code> of the document) 对象。在浏览器中,这是事件所在的 {{ domxref("Window") }} 对象。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var <em>view</em> = <em>event</em>.view; +</pre> + +<ul> + <li><code>view</code> 是对 <code>AbstractView</code> 对象的引用。</li> +</ul> + +<h2 id="技术参数">技术参数</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规格</th> + <th scope="col">状态</th> + <th scope="col">注释</th> + </tr> + <tr> + <td>{{SpecName('DOM3 Events', '#interface-UIEvent', 'UIEvent')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td>从 {{SpecName('DOM2 Events')}}, 将 <code>view</code> 类型从 <code>AbstractView</code> 更改为 <code>WindowProxy</code>.</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Events', '#Events-UIEvent', 'UIEvent')}}</td> + <td>{{Spec2('DOM2 Events')}}</td> + <td>最初的定义。</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器的兼容性">浏览器的兼容性</h2> + +<div class="hidden">本页上的兼容性表是由结构化数据生成的。如果您想贡献数据,请查看<a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 并向我们发送请求。</div> + +<p>{{Compat("api.UIEvent.view")}}</p> |