diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:43:23 -0500 |
commit | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch) | |
tree | a9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/zh-tw/web/api/uievent | |
parent | 074785cea106179cb3305637055ab0a009ca74f2 (diff) | |
download | translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2 translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip |
initial commit
Diffstat (limited to 'files/zh-tw/web/api/uievent')
-rw-r--r-- | files/zh-tw/web/api/uievent/index.html | 188 | ||||
-rw-r--r-- | files/zh-tw/web/api/uievent/uievent/index.html | 134 |
2 files changed, 322 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/uievent/index.html b/files/zh-tw/web/api/uievent/index.html new file mode 100644 index 0000000000..a5a1228ec8 --- /dev/null +++ b/files/zh-tw/web/api/uievent/index.html @@ -0,0 +1,188 @@ +--- +title: UIEvent +slug: Web/API/UIEvent +tags: + - 待翻譯 +translation_of: Web/API/UIEvent +--- +<p>{{APIRef("DOM Events")}}</p> + +<p><strong><code>UIEvent</code></strong> 介面是使用者介面的事件的基本型態。</p> + +<p><code>UIEvent</code> 是從 {{domxref("Event")}} 衍伸過來。 雖然為了相容性,仍留著 {{domxref("UIEvent.initUIEvent()")}} 方法,建立 <code>UIEvent</code> 物件最好是選擇以 {{domxref("UIEvent.UIEvent", "UIEvent()")}} constructor 建立。</p> + +<p>許多介面直接或間接繼承此介面,例如:{{domxref("MouseEvent")}}、{{domxref("TouchEvent")}}、{{domxref("FocusEvent")}}、{{domxref("KeyboardEvent")}}、{{domxref("WheelEvent")}}、{{domxref("InputEvent")}} 和 {{domxref("CompositionEvent")}}。</p> + +<h2 id="建構式">建構式</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>Is a {{jsxref("Boolean")}} indicating whether the bubbling of the event has been canceled or not.</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>Returns a {{jsxref("Boolean")}} indicating whether the event produced a key character or not.</dd> + <dt>{{domxref("UIEvent.layerX")}} {{Non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns the horizontal coordinate of the event relative to the current layer.</dd> + <dt>{{domxref("UIEvent.layerY")}} {{Non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns the vertical coordinate of the event relative to the current layer.</dd> + <dt>{{domxref("UIEvent.pageX")}} {{Non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns the horizontal coordinate of the event relative to the whole document.</dd> + <dt>{{domxref("UIEvent.pageY")}} {{Non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns the vertical coordinate of the event relative to the whole document.</dd> + <dt>{{domxref("UIEvent.sourceCapabilities")}} {{non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns an instance of the InputDeviceCapabilities interface which provides information about the physical device responsible for generating a touch event.</dd> + <dt>{{domxref("UIEvent.view")}}{{readonlyinline}}</dt> + <dd>Returns a {{domxref("WindowProxy")}} that contains the view that generated the event.</dd> + <dt>{{domxref("UIEvent.which")}} {{Non-standard_inline}} {{readonlyinline}}</dt> + <dd>Returns the numeric <code>keyCode</code> of the key pressed, or the character code (<code>charCode</code>) for an alphanumeric key pressed.</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 id="規範">規範</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="Browser_compatibility" name="Browser_compatibility">瀏覽器相容性</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="/en-US/docs/Learn/JavaScript/Building_blocks/Events">Introduction to events</a></li> + <li>{{domxref("Event")}}</li> +</ul> diff --git a/files/zh-tw/web/api/uievent/uievent/index.html b/files/zh-tw/web/api/uievent/uievent/index.html new file mode 100644 index 0000000000..d18be6387f --- /dev/null +++ b/files/zh-tw/web/api/uievent/uievent/index.html @@ -0,0 +1,134 @@ +--- +title: UIEvent() +slug: Web/API/UIEvent/UIEvent +translation_of: Web/API/UIEvent/UIEvent +--- +<p>{{APIRef("DOM Events")}}</p> + +<p><strong><code>UIEvent()</code></strong> constructor 是用來建立新的 {{domxref("UIEvent")}}。</p> + +<h2 id="語法">語法</h2> + +<pre class="syntaxbox"> <em>event</em> = new UIEvent(<em>typeArg</em>, <em>UIEventInit</em>);</pre> + +<h3 id="參數">參數</h3> + +<dl> + <dt><em>typeArg</em></dt> + <dd>一個 {{domxref("DOMString")}} ,用來表示事件名稱</dd> + <dt><em>UIEventInit</em>{{optional_inline}}</dt> +</dl> + +<dl> + <dd>一個 <code>UIEventInit</code> dictionary ,能接受以下參數: + + <table class="standard-table"> + <thead> + <tr> + <th>參數</th> + <th>可選</th> + <th>默認值</th> + <th>類型</th> + <th>說明</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>"detail"</code></td> + <td>●</td> + <td><code>0</code></td> + <td><code>long</code></td> + <td>定義事件意義的值。關於事件的意義於 {{domxref("UIEvent.detail")}} 已有較詳盡的列表。</td> + </tr> + <tr> + <td><code>"view"</code></td> + <td>●</td> + <td><code>null</code></td> + <td>{{domxref("WindowProxy")}}</td> + <td>與事件相關的 {{domxref("Window")}} 。</td> + </tr> + </tbody> + </table> + + <div class="note"> + <p><em><code>UIEventInit</code> dictionary 亦接受 {{domxref("Event.Event", "EventInit")}} dictionary 所接受的參數。</em></p> + </div> + </dd> +</dl> + +<h2 id="Specifications" name="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('DOM3 Events','#interface-UIEvent','UIEvent()')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td>原始定義。</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>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatGeckoDesktop(11) }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</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>Chrome for Android</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>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatGeckoMobile(11) }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + <td>{{ CompatUnknown() }}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="延伸閱讀">延伸閱讀</h2> + +<ul> + <li>{{domxref("UIEvent")}},此 constructer 所建立的 object 的 interface。</li> +</ul> |