Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / webidl / InputEvent.webidl
blob95b3baca6dfe19be7c90b5512dbb93598476e14e
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  */
10 [Exposed=Window]
11 interface InputEvent : UIEvent
13   constructor(DOMString type, optional InputEventInit eventInitDict = {});
15   readonly attribute boolean       isComposing;
17   [Pref="dom.inputevent.inputtype.enabled"]
18   readonly attribute DOMString inputType;
20   [NeedsCallerType, Pref="dom.inputevent.data.enabled"]
21   readonly attribute DOMString? data;
24 dictionary InputEventInit : UIEventInit
26   boolean isComposing = false;
27   DOMString inputType = "";
28   // NOTE:  Currently, default value of `data` attribute is declared as empty
29   //        string by UI Events.  However, both Chrome and Safari uses `null`,
30   //        and there is a spec issue about this:
31   //        https://github.com/w3c/uievents/issues/139
32   //        So, we take `null` for compatibility with them.
33   DOMString? data = null;
36 // https://w3c.github.io/input-events/#interface-InputEvent
37 // https://rawgit.com/w3c/input-events/v1/index.html#interface-InputEvent
38 partial interface InputEvent
40   [NeedsCallerType, Pref="dom.inputevent.datatransfer.enabled"]
41   readonly attribute DataTransfer? dataTransfer;
42   // Enable `getTargetRanges()` only when `beforeinput` event is enabled
43   // because this may be used for feature detection of `beforeinput` event
44   // support (due to Chrome not supporting `onbeforeinput` attribute).
45   [Pref="dom.input_events.beforeinput.enabled"]
46   sequence<StaticRange> getTargetRanges();
49 partial dictionary InputEventInit
51   [Pref="dom.inputevent.datatransfer.enabled"]
52   DataTransfer? dataTransfer = null;
53   [Pref="dom.input_events.beforeinput.enabled"]
54   sequence<StaticRange> targetRanges = [];