InputEvent.webidl (1736B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/input-events/#interface-InputEvent 8 */ 9 10 [Exposed=Window] 11 interface InputEvent : UIEvent 12 { 13 constructor(DOMString type, optional InputEventInit eventInitDict = {}); 14 15 readonly attribute boolean isComposing; 16 17 readonly attribute DOMString inputType; 18 19 [NeedsCallerType] 20 readonly attribute DOMString? data; 21 }; 22 23 dictionary InputEventInit : UIEventInit 24 { 25 boolean isComposing = false; 26 DOMString inputType = ""; 27 // NOTE: Currently, default value of `data` attribute is declared as empty 28 // string by UI Events. However, both Chrome and Safari uses `null`, 29 // and there is a spec issue about this: 30 // https://github.com/w3c/uievents/issues/139 31 // So, we take `null` for compatibility with them. 32 DOMString? data = null; 33 }; 34 35 // https://w3c.github.io/input-events/#interface-InputEvent 36 // https://rawgit.com/w3c/input-events/v1/index.html#interface-InputEvent 37 partial interface InputEvent 38 { 39 [NeedsCallerType] 40 readonly attribute DataTransfer? dataTransfer; 41 // Enable `getTargetRanges()` only when `beforeinput` event is enabled 42 // because this may be used for feature detection of `beforeinput` event 43 // support (due to Chrome not supporting `onbeforeinput` attribute). 44 sequence<StaticRange> getTargetRanges(); 45 }; 46 47 partial dictionary InputEventInit 48 { 49 DataTransfer? dataTransfer = null; 50 sequence<StaticRange> targetRanges = []; 51 };