1/* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4/* 5 * The origin of this IDL file is 6 * https://w3c.github.io/uievents/#interface-keyboardevent 7 * 8 */ 9 10[Constructor(DOMString typeArg, optional KeyboardEventInit keyboardEventInitDict)] 11interface KeyboardEvent : UIEvent { 12 // KeyLocationCode 13 const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; 14 const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; 15 const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; 16 const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; 17 readonly attribute DOMString key; 18 readonly attribute DOMString code; 19 readonly attribute unsigned long location; 20 readonly attribute boolean ctrlKey; 21 readonly attribute boolean shiftKey; 22 readonly attribute boolean altKey; 23 readonly attribute boolean metaKey; 24 readonly attribute boolean repeat; 25 readonly attribute boolean isComposing; 26 boolean getModifierState (DOMString keyArg); 27}; 28 29// https://w3c.github.io/uievents/#idl-interface-KeyboardEvent-initializers 30partial interface KeyboardEvent { 31 // Originally introduced (and deprecated) in DOM Level 3 32 void initKeyboardEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, 33 DOMString keyArg, unsigned long locationArg, DOMString modifiersListArg, 34 boolean repeat, DOMString locale); 35}; 36 37// https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent 38partial interface KeyboardEvent { 39 // The following support legacy user agents 40 readonly attribute unsigned long charCode; 41 readonly attribute unsigned long keyCode; 42 readonly attribute unsigned long which; 43}; 44 45// https://w3c.github.io/uievents/#dictdef-keyboardeventinit 46dictionary KeyboardEventInit : EventModifierInit { 47 DOMString key = ""; 48 DOMString code = ""; 49 unsigned long location = 0; 50 boolean repeat = false; 51 boolean isComposing = false; 52}; 53 54// https://w3c.github.io/uievents/#legacy-dictionary-KeyboardEventInit 55/*partial dictionary KeyboardEventInit { 56 unsigned long charCode = 0; 57 unsigned long keyCode = 0; 58 unsigned long which = 0; 59};*/ 60