aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/api/keyboardevent/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
commit218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch)
treea9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/zh-tw/web/api/keyboardevent/index.html
parent074785cea106179cb3305637055ab0a009ca74f2 (diff)
downloadtranslated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip
initial commit
Diffstat (limited to 'files/zh-tw/web/api/keyboardevent/index.html')
-rw-r--r--files/zh-tw/web/api/keyboardevent/index.html449
1 files changed, 449 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/keyboardevent/index.html b/files/zh-tw/web/api/keyboardevent/index.html
new file mode 100644
index 0000000000..31d75cdf1f
--- /dev/null
+++ b/files/zh-tw/web/api/keyboardevent/index.html
@@ -0,0 +1,449 @@
+---
+title: KeyboardEvent
+slug: Web/API/KeyboardEvent
+tags:
+ - 待翻譯
+translation_of: Web/API/KeyboardEvent
+---
+<p>{{APIRef("DOM Events")}}</p>
+
+<p><strong><code>KeyboardEvent</code></strong> objects 用來詳述使用者和網頁之間,經由鍵盤產生的互動。每個事件(<code>event</code>)都記錄著一次鍵盤動作。事件類型(<code>keydown</code> 、 <code>keypress</code> 和 <code>keyup</code>)用來表示鍵盤執行哪種動作。</p>
+
+<div class="note"><strong>注意:</strong> <code>KeyboardEvent</code> 僅顯示在鍵盤上發生的事。當你需要進行文字輸入的操作,請使用 HTML5 <code><a href="/en-US/docs/DOM/DOM_event_reference/input" rel="custom">input</a></code> event 代替 <code>KeyboardEvent</code> 。舉例來說,當使用者在手寫系統,例如平板電腦,輸入文字時,並不會啟動 key events 。</div>
+
+<h2 id="Constructor">Constructor</h2>
+
+<dl>
+ <dt>{{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}</dt>
+ <dd>建立一 <code>KeyboardEvent</code> object。</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p><em>本介面( interface)亦繼承其父, {{domxref("UIEvent")}} 和 {{domxref("Event")}} ,的 methods</em></p>
+
+<dl>
+ <dt>{{domxref("KeyboardEvent.getModifierState()")}}</dt>
+ <dd>回傳一 {{jsxref("Boolean")}}。用來表示當事件建立時,修飾鍵(例如 <kbd>Alt</kbd>、 <kbd>Shift</kbd>、 <kbd>Ctrl</kbd>、或是 <kbd>Meta</kbd>) 是否是按下的。</dd>
+ <dt>{{domxref("KeyboardEvent.initKeyEvent()")}}{{deprecated_inline}}</dt>
+ <dd>初始化一個 <code>KeyboardEvent</code> object。這個 method 只有 Gecko 有在使用(其他瀏覽器是使用 {{domxref("KeyboardEvent.initKeyboardEvent()")}}),並且不應該再繼續使用。現代的標準規範是使用 {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} constructor。</dd>
+ <dt>{{domxref("KeyboardEvent.initKeyboardEvent()")}}{{deprecated_inline}}</dt>
+ <dd>初始化一個 <code>KeyboardEvent</code> object。 Gecko 從未實作過該 method (Gecko 是使用 {{domxref("KeyboardEvent.initKeyEvent()")}}) ,並且不應該再繼續使用。現代的標準規範是使用 {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}} constructor。</dd>
+</dl>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>本介面( interface)亦繼承其父,{{domxref("UIEvent")}} 和 {{domxref("Event")}} ,的 properties 。</em></p>
+
+<dl>
+ <dt>{{domxref("KeyboardEvent.altKey")}} {{Readonlyinline}}</dt>
+ <dd>一個 {{jsxref("Boolean")}} 。用來表示在事件建立時, <kbd>Alt</kbd> (OS X 中是 <kbd>Option</kbd> 或 <kbd>⌥</kbd> ) 鍵是否執行中。</dd>
+ <dt>{{domxref("KeyboardEvent.char")}} {{Non-standard_inline}}{{Deprecated_inline}}{{Readonlyinline}}</dt>
+ <dd>一個 {{domxref("DOMString")}} ,返回鍵盤對應的字符。若是該鍵對應一個實際的字符,則其值為對應該字符的一個非空的 Unicode 字串;若沒對應的話,則返回一個空字串。
+ <div class="note"><strong>Note:</strong> If the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character.</div>
+
+ <div class="warning"><strong>警告:</strong> 在 DOM Level 3 Events ,該 propertie 已被移除。現在只有 IE9+ 支持它。</div>
+ </dd>
+ <dt>{{domxref("KeyboardEvent.charCode")}} {{Deprecated_inline}}{{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Number")}} representing the Unicode reference number of the key; this attribute is used only by the <code>keypress</code> event. For keys whose <code>char</code> attribute contains multiple characters, this is the Unicode value of the first character in that attribute. In Firefox 26 this returns codes for printable characters.
+ <div class="warning"><strong>警告:</strong> 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}} 。</div>
+ </dd>
+ <dt>{{domxref("KeyboardEvent.code")}} {{Readonlyinline}}</dt>
+ <dd>一個 {{domxref("DOMString")}} 。返回事件對應的按鍵的代碼。</dd>
+ <dt>{{domxref("KeyboardEvent.ctrlKey")}} {{Readonlyinline}}</dt>
+ <dd>一個 {{jsxref("Boolean")}} 。用來表示在事件建立時, <kbd>Ctrl</kbd> 鍵是否執行中。</dd>
+ <dt>{{domxref("KeyboardEvent.isComposing")}} {{Readonlyinline}}</dt>
+ <dd>一個 {{jsxref("Boolean")}} 。用來表示其觸發時間是否在 <code>compositionstart</code> 和 <code>compositionend</code> 之間。</dd>
+ <dt>{{domxref("KeyboardEvent.key")}} {{Readonlyinline}}</dt>
+ <dd>一個 {{domxref("DOMString")}} ,用來事件對應的按鍵的值(key value)。</dd>
+ <dt>{{domxref("KeyboardEvent.keyCode")}} {{deprecated_inline}}{{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Number")}} representing a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
+ <div class="warning"><strong>警告:</strong> 此 attribute 已被淘汰。如果可以,建議使用{{domxref("KeyboardEvent.key")}} 。</div>
+ </dd>
+ <dt>{{domxref("KeyboardEvent.locale")}} {{Readonlyinline}}</dt>
+ <dd>Returns a {{domxref("DOMString")}} representing a locale string indicating the locale the keyboard is configured for. This may be the empty string if the browser or device doesn't know the keyboard's locale.
+ <div class="note"><strong>Note:</strong> This does not describe the locale of the data being entered. A user may be using one keyboard layout while typing text in a different language.</div>
+ </dd>
+ <dt>{{domxref("KeyboardEvent.location")}}<a> {{Readonlyinline}}</a></dt>
+ <dd>Returns a {{jsxref("Number")}} representing the location of the key on the keyboard or other input device.</dd>
+ <dt>{{domxref("KeyboardEvent.metaKey")}} {{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Boolean")}} that is <code>true</code> if the <kbd>Meta</kbd> (on Mac keyboards, the <kbd>⌘ Command</kbd> key; on Windows keyboards, the Windows key (<kbd>⊞</kbd>)) key was active when the key event was generated.</dd>
+ <dt>{{domxref("KeyboardEvent.repeat")}} {{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Boolean")}} that is <code>true</code> if the key is being held down such that it is automatically repeating.</dd>
+ <dt>{{domxref("KeyboardEvent.shiftKey")}} {{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Boolean")}} that is <code>true</code> if the <kbd>Shift</kbd> key was active when the key event was generated.</dd>
+ <dt>{{domxref("KeyboardEvent.which")}} {{deprecated_inline}}{{Readonlyinline}}</dt>
+ <dd>Returns a {{jsxref("Number")}} representing a system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as <code>keyCode</code>.
+ <div class="warning"><strong>警告:</strong> 此 attribute 已被淘汰。如果可以,建議使用 {{domxref("KeyboardEvent.key")}} 。</div>
+ </dd>
+</dl>
+
+<h2 id="注意">注意</h2>
+
+<p>KeyboardEvent 有 <code>keydown</code> 、 <code>keypress</code> 、 <code>keyup</code> 三種事件。對大多數的按鍵而言, Gecko 觸發事件的順序如下:</p>
+
+<ol>
+ <li>當按鍵按下時,會送出 <code>keydown</code> event 。</li>
+ <li>當按鍵不是特殊鍵( modifier key),例如<kbd>Ctrl</kbd> 、<kbd>Alt</kbd>……等等,會送出 <code>keypress</code> event 。</li>
+ <li>當按鍵放開時,會送出 <code>keyup</code> event 。</li>
+</ol>
+
+<h3 id="特殊狀況">特殊狀況</h3>
+
+<p>某些按鍵,例如 <kbd>Caps Lock</kbd> 、 <kbd>Num Lock</kbd> 和 <kbd>Scroll Lock</kbd> 能切換鍵盤上的 LED 燈。在 Windows 和 Linux 系統上,這些按鍵只會觸發 <code>keydown</code> 和 <code>keyup</code> 事件。但是 Linux 上的 Firefox 12 或更早的版本亦會觸發 <code>keypress</code> 事件。</p>
+
+<p>而在 Mac 電腦則不同, <kbd>Caps Lock</kbd> 只會觸發 <code>keydown</code> 事件;而 <kbd>Num Lock</kbd> 則是只有舊版的 Mac 電腦(2007 或之前的版本)才有,現在的 Mac 即便使用外部鍵盤也不支援  <kbd>Num Lock</kbd> 。雖說舊版的 Mac 電腦支援 <kbd>Num Lock</kbd> 鍵,但 <kbd>Num Lock</kbd>  並不會執行任何 KeyboardEvent;而 Gecko 瀏覽器在特殊情況(外接一個有 <kbd>F14</kbd> 的鍵盤)下能支援 <kbd>Scroll Lock</kbd> ,但是它會產生 <code>keypress</code> 事件。這個異常狀態是個 bug ,詳情可參考 {{bug(602812)}}。</p>
+
+<h3 id="自動迴圈(Auto-Repeat_)的執行">自動迴圈(Auto-Repeat )的執行</h3>
+
+<p>當按鍵按下去不放時,它會開始一個自動迴圈。並導致觸發一系列的相似事件,如下所示:</p>
+
+<ol>
+ <li><code>keydown</code></li>
+ <li><code>keypress</code></li>
+ <li><code>keydown</code></li>
+ <li><code>keypress</code></li>
+ <li>(不斷重複,直到使用者放開按鍵)</li>
+ <li><code>keyup</code></li>
+</ol>
+
+<p>在 DOM Level 3 說明書有提及這問題是會發生的。其中所存在的問題如下說明:</p>
+
+<h4 id="部分_GTK_環境,例如_Ubuntu_9.4_,的自動迴圈">部分 GTK 環境,例如 Ubuntu 9.4 ,的自動迴圈</h4>
+
+<p>部分的 GTK-based 環境之中,自動迴圈在發生的過程中會自動觸發電腦本機的 key-up 事件。然而,對 Gecko 而言,並沒有方法可以分辨使用者重複點擊按鍵與自動迴圈(按鍵按住不放)的差異。在這類的環境下,按鍵按住不放會重複執行下列事件:</p>
+
+<ol>
+ <li><code>keydown</code></li>
+ <li><code>keypress</code></li>
+ <li><code>keyup</code></li>
+ <li><code>keydown</code></li>
+ <li><code>keypress</code></li>
+ <li><code>keyup</code></li>
+ <li>(不斷重複,直到使用者放開按鍵)</li>
+ <li><code>keyup</code></li>
+</ol>
+
+<p>不幸地,在這些環境之下,web content 亦沒有方法告訴使用者重複點擊按鍵與自動迴圈的差異。</p>
+
+<h4 id="Gecko_5.0_以前的自動迴圈">Gecko 5.0 以前的自動迴圈</h4>
+
+<p>Gecko 5.0 {{geckoRelease('5.0')}} 以前,在不同平台上,鍵盤的處理與現在相比較不統一。</p>
+
+<dl>
+ <dt>Windows</dt>
+ <dd>自動迴圈的結果與 Gecko 4.0 或更新的版本類似</dd>
+ <dt>Mac</dt>
+ <dd>在第一個 keydown 執行後,僅執行 keypress 事件,一直到案件放開(即送出 keyup 事件指令),過程中不會送出任何 keydown 事件。</dd>
+ <dt>Linux</dt>
+ <dd>鍵盤事件的執行根據平台不同而有所不同。它有可能表現得像是 Windows 也有可能像 Mac ,這取決於本地的事件模型(native event model)是如何執行的。</dd>
+</dl>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script&gt;
+var metaChar = false;
+var exampleKey = 16;
+
+function keyEvent(event) {
+ var key = event.keyCode || event.which;
+ var keychar = String.fromCharCode(key);
+ if (key == exampleKey) {
+ metaChar = true;
+ }
+ if (key != exampleKey) {
+ if (metaChar) {
+ alert("Combination of metaKey + " + keychar);
+ metaChar = false;
+ } else {
+ alert("Key pressed " + key);
+ }
+ }
+}
+
+function metaKeyUp (event) {
+ var key = event.keyCode || event.which;
+
+ if (key == exampleKey) {
+ metaChar = false;
+ }
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onkeydown="keyEvent(event)" onkeyup="metaKeyUp(event)"&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<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('DOM3 Events', '#interface-KeyboardEvent', 'KeyboardEvent')}}</td>
+ <td>{{Spec2('DOM3 Events')}}</td>
+ <td>原始定義</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>The <code>KeyboardEvent</code> interface specification went through numerous draft versions, first under DOM Events Level 2 where it was dropped as no consensus arose, then under DOM Events Level 3. This led to the implementation of non-standard initialization methods, the early DOM Events Level 2 version, {{domxref("KeyboardEvent.initKeyEvent()")}} by Gecko browsers and the early DOM Events Level 3 version, {{domxref("KeyboardEvent.initKeyboardEvent()")}} by others. Both have been superseded by the modern usage of a constructor: {{domxref("KeyboardEvent.KeyboardEvent", "KeyboardEvent()")}}.</p>
+
+<h2 id="瀏覽器支援度">瀏覽器支援度</h2>
+
+<p>More compatibility data is available on other pages:</p>
+
+<ul>
+ <li><code>.code</code>  :請參考《瀏覽器支援度》的 {{domxref("KeyboardEvent.code")}} 部分。</li>
+ <li><code>.key</code>:請參考《瀏覽器支援度》的 {{domxref("KeyboardEvent.key")}} 部分。</li>
+ <li><code>.getModifierState()</code> :請參考《瀏覽器支援度》的 {{domxref("KeyboardEvent.getModifierState")}} 部分。</li>
+</ul>
+
+<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 (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td>constructor</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("31.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.char</code></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.charCode</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.code</code></td>
+ <td colspan="5" rowspan="1">See Browser compatibility of {{domxref("KeyboardEvent.code")}}.</td>
+ </tr>
+ <tr>
+ <td><code>.isComposing</code></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoDesktop("31.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.key</code></td>
+ <td colspan="5" rowspan="1">See Browser compatibility of {{domxref("KeyboardEvent.key")}}.</td>
+ </tr>
+ <tr>
+ <td><code>.keyCode</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.locale</code></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.location</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("15.0")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.repeat</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("28.0")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.which</code></td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.getModifierState()</code></td>
+ <td colspan="5" rowspan="1">See Browser compatibility of {{domxref("KeyboardEvent.getModifierState")}}</td>
+ </tr>
+ <tr>
+ <td><code>.initKeyboardEvent()</code></td>
+ <td>{{CompatVersionUnknown}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}<sup>[2]</sup></td>
+ <td>{{CompatIE("9.0")}}<sup>[3]</sup></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}<sup>[1]</sup></td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td>constructor</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("31.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.char</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.charCode</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.code</code></td>
+ <td colspan="5" rowspan="1">See Browser compatibility of {{domxref("KeyboardEvent.code")}}.</td>
+ </tr>
+ <tr>
+ <td><code>.isComposing</code></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("31.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ <tr>
+ <td><code>.key</code></td>
+ <td colspan="6">See Browser compatibility table of {{domxref("KeyboardEvent.key")}}.</td>
+ </tr>
+ <tr>
+ <td><code>.keyCode</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.locale</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.location</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("15.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.repeat</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("28.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.which</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>.getModifierState()</code></td>
+ <td colspan="5" rowspan="1">See Browser compatibility of {{domxref("KeyboardEvent.getModifierState")}}</td>
+ </tr>
+ <tr>
+ <td><code>.initKeyboardEvent()</code></td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] The arguments of <code>initKeyboardEvent()</code> of WebKit and Blink's are different from the definition in DOM Level 3 Events. The method is: <code>initKeyboardEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in DOMString keyIndentifierArg, in number locationArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, in boolean metaKeyArg, in boolean altGraphKeyArg)</code></p>
+
+<p>[2] Gecko won't support <code>initKeyboardEvent()</code> because supporting it completely breaks feature detection of web applications. See {{Bug(999645)}}.</p>
+
+<p>[3] The argument of <code>initKeyboardEvent()</code> of IE is different from the definition in DOM Level 3 Events. The method is: <code>initKeyboardEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in DOMString keyArg, in number locationArg, in DOMString modifierListArg, in boolean repeatArt, in DOMString locationArg)</code>. See <a href="http://msdn.microsoft.com/en-us/library/ie/ff975297%28v=vs.85%29.aspx">document of <code>initKeyboardEvent()</code> in MSDN</a>.</p>
+
+<p><a href="http://www.howtocreate.co.uk/tutorials/javascript/domevents#domevld1">[4]</a> Note that manually firing an event does <em>not</em> generate the default action associated with that event. For example, manually firing a key event does not cause that letter to appear in a focused text input. In the case of UI events, this is important for security reasons, as it prevents scripts from simulating user actions that interact with the browser itself.</p>