Backed out changeset 8aaffdf63d09 (bug 1920575) for causing bc failures on browser_si...
[gecko.git] / dom / webidl / HTMLInputElement.webidl
blob4209483ee8b118ffe999810e24a5a39fd82f7691
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  * http://www.whatwg.org/specs/web-apps/current-work/#the-input-element
8  * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
9  * https://wicg.github.io/entries-api/#idl-index
10  *
11  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
12  * Opera Software ASA. You are granted a license to use, reproduce
13  * and create derivative works of this document.
14  */
16 enum SelectionMode {
17   "select",
18   "start",
19   "end",
20   "preserve",
23 interface XULControllers;
25 [Exposed=Window,
26  InstrumentedProps=(capture,
27                     incremental,
28                     onsearch,
29                     popoverTargetAction,
30                     popoverTargetElement,
31                     webkitEntries,
32                     webkitdirectory)]
33 interface HTMLInputElement : HTMLElement {
34   [HTMLConstructor] constructor();
36   [CEReactions, Pure, SetterThrows]
37            attribute DOMString accept;
38   [CEReactions, Pure, SetterThrows]
39            attribute DOMString alt;
40   [CEReactions, Pure, SetterThrows]
41            attribute DOMString autocomplete;
42   [CEReactions, Pure, SetterThrows, Pref="dom.capture.enabled"]
43            attribute DOMString capture;
44   [CEReactions, Pure, SetterThrows]
45            attribute boolean defaultChecked;
46   [Pure]
47            attribute boolean checked;
48   [CEReactions, Pure, SetterThrows]
49            attribute DOMString dirName;
50   [CEReactions, Pure, SetterThrows]
51            attribute boolean disabled;
52   readonly attribute HTMLFormElement? form;
53   [Pure]
54            attribute FileList? files;
55   [CEReactions, Pure, SetterThrows]
56            attribute DOMString formAction;
57   [CEReactions, Pure, SetterThrows]
58            attribute DOMString formEnctype;
59   [CEReactions, Pure, SetterThrows]
60            attribute DOMString formMethod;
61   [CEReactions, Pure, SetterThrows]
62            attribute boolean formNoValidate;
63   [CEReactions, Pure, SetterThrows]
64            attribute DOMString formTarget;
65   [CEReactions, Pure, SetterThrows]
66            attribute unsigned long height;
67   [Pure]
68            attribute boolean indeterminate;
69   [Pure]
70   readonly attribute HTMLDataListElement? list;
71   [CEReactions, Pure, SetterThrows]
72            attribute DOMString max;
73   [CEReactions, Pure, SetterThrows]
74            attribute long maxLength;
75   [CEReactions, Pure, SetterThrows]
76            attribute DOMString min;
77   [CEReactions, Pure, SetterThrows]
78            attribute long minLength;
79   [CEReactions, Pure, SetterThrows]
80            attribute boolean multiple;
81   [CEReactions, Pure, SetterThrows]
82            attribute DOMString name;
83   [CEReactions, Pure, SetterThrows]
84            attribute DOMString pattern;
85   [CEReactions, Pure, SetterThrows]
86            attribute DOMString placeholder;
87   [CEReactions, Pure, SetterThrows]
88            attribute boolean readOnly;
89   [CEReactions, Pure, SetterThrows]
90            attribute boolean required;
91   [CEReactions, Pure, SetterThrows]
92            attribute unsigned long size;
93   [CEReactions, Pure, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
94            attribute DOMString src;
95   [CEReactions, Pure, SetterThrows]
96            attribute DOMString step;
97   [CEReactions, Pure, SetterThrows]
98            attribute DOMString type;
99   [CEReactions, Pure, SetterThrows]
100            attribute DOMString defaultValue;
101   [CEReactions, Pure, SetterThrows, NeedsCallerType]
102            attribute [LegacyNullToEmptyString] DOMString value;
103   [Throws]
104            attribute object? valueAsDate;
105   [Pure, SetterThrows]
106            attribute unrestricted double valueAsNumber;
107   [CEReactions, SetterThrows]
108            attribute unsigned long width;
110   [Throws]
111   undefined stepUp(optional long n = 1);
112   [Throws]
113   undefined stepDown(optional long n = 1);
115   [Pure]
116   readonly attribute boolean willValidate;
117   [Pure]
118   readonly attribute ValidityState validity;
119   [Throws]
120   readonly attribute DOMString validationMessage;
121   boolean checkValidity();
122   boolean reportValidity();
123   undefined setCustomValidity(DOMString error);
125   readonly attribute NodeList? labels;
127   undefined select();
129   [Throws]
130            attribute unsigned long? selectionStart;
131   [Throws]
132            attribute unsigned long? selectionEnd;
133   [Throws]
134            attribute DOMString? selectionDirection;
135   [Throws]
136   undefined setRangeText(DOMString replacement);
137   [Throws]
138   undefined setRangeText(DOMString replacement, unsigned long start,
139     unsigned long end, optional SelectionMode selectionMode = "preserve");
140   [Throws]
141   undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
143   [Throws]
144   undefined showPicker();
146   // also has obsolete members
149 partial interface HTMLInputElement {
150   [CEReactions, Pure, SetterThrows]
151            attribute DOMString align;
152   [CEReactions, Pure, SetterThrows]
153            attribute DOMString useMap;
156 // Mozilla extensions
158 partial interface HTMLInputElement {
159   [GetterThrows, ChromeOnly]
160   readonly attribute XULControllers?       controllers;
161   // Binaryname because we have a FragmentOrElement function named "TextLength()".
162   [NeedsCallerType, BinaryName="inputTextLength"]
163   readonly attribute long                  textLength;
165   [Throws, ChromeOnly]
166   sequence<DOMString> mozGetFileNameArray();
168   [ChromeOnly, Throws]
169   undefined mozSetFileNameArray(sequence<DOMString> fileNames);
171   [ChromeOnly]
172   undefined mozSetFileArray(sequence<File> files);
174   // This method is meant to use for testing only.
175   [ChromeOnly, Throws]
176   undefined mozSetDirectory(DOMString directoryPath);
178   // This method is meant to use for testing only.
179   [ChromeOnly]
180   undefined mozSetDndFilesAndDirectories(sequence<(File or Directory)> list);
182   // This method is meant to use for testing only.
183   [ChromeOnly, NewObject]
184   Promise<sequence<(File or Directory)>> getFilesAndDirectories();
186   boolean mozIsTextField(boolean aExcludePassword);
188   [ChromeOnly]
189   readonly attribute boolean hasBeenTypePassword;
191   [ChromeOnly]
192   attribute DOMString previewValue;
194   // A string indicating that the value of the element has been autofilled:
195   // either "filled", "preview" or "".
196   [ChromeOnly]
197   attribute DOMString autofillState;
199   // Last value entered by the user, not by a script.
200   // NOTE(emilio): As of right now some execCommand triggered changes might be
201   // considered interactive.
202   [ChromeOnly]
203   readonly attribute DOMString lastInteractiveValue;
205   [ChromeOnly]
206   // This function will return null if @autocomplete is not defined for the
207   // current @type
208   AutocompleteInfo? getAutocompleteInfo();
210   [ChromeOnly]
211   // The reveal password state for a type=password control.
212   attribute boolean revealPassword;
215 interface mixin MozEditableElement {
216   // Returns an nsIEditor instance which is associated with the element.
217   // If the element can be associated with an editor but not yet created,
218   // this creates new one automatically.
219   [Pure, ChromeOnly, BinaryName="editorForBindings"]
220   readonly attribute nsIEditor? editor;
222   // Returns true if an nsIEditor instance has already been associated with
223   // the element.
224   [Pure, ChromeOnly]
225   readonly attribute boolean hasEditor;
227   // This is set to true if "input" event should be fired with InputEvent on
228   // the element.  Otherwise, i.e., if "input" event should be fired with
229   // Event, set to false.
230   [ChromeOnly]
231   readonly attribute boolean isInputEventTarget;
233   // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
234   // of the value change is closer to the normal user input, so 'change' event
235   // for example will be dispatched when focusing out the element.
236   [Func="IsChromeOrUAWidget", NeedsSubjectPrincipal]
237   undefined setUserInput(DOMString input);
240 HTMLInputElement includes MozEditableElement;
242 HTMLInputElement includes MozImageLoadingContent;
244 HTMLInputElement includes PopoverInvokerElement;
246 HTMLInputElement includes InvokerElement;
248 // https://wicg.github.io/entries-api/#idl-index
249 partial interface HTMLInputElement {
250   [Pref="dom.webkitBlink.filesystem.enabled", Frozen, Cached, Pure]
251   readonly attribute sequence<FileSystemEntry> webkitEntries;
253   [Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows]
254           attribute boolean webkitdirectory;
257 dictionary DateTimeValue {
258   long hour;
259   long minute;
260   long year;
261   long month;
262   long day;
265 partial interface HTMLInputElement {
266   [ChromeOnly]
267   DateTimeValue getDateTimeInputBoxValue();
269   [ChromeOnly]
270   readonly attribute Element? dateTimeBoxElement;
272   [ChromeOnly, BinaryName="getMinimumAsDouble"]
273   double getMinimum();
275   [ChromeOnly, BinaryName="getMaximumAsDouble"]
276   double getMaximum();
278   [Func="IsChromeOrUAWidget"]
279   undefined openDateTimePicker(optional DateTimeValue initialValue = {});
281   [Func="IsChromeOrUAWidget"]
282   undefined updateDateTimePicker(optional DateTimeValue value = {});
284   [Func="IsChromeOrUAWidget"]
285   undefined closeDateTimePicker();
287   [Func="IsChromeOrUAWidget"]
288   undefined setFocusState(boolean aIsFocused);
290   [Func="IsChromeOrUAWidget"]
291   undefined updateValidityState();
293   [Func="IsChromeOrUAWidget", BinaryName="getStepAsDouble"]
294   double getStep();
296   [Func="IsChromeOrUAWidget", BinaryName="getStepBaseAsDouble"]
297   double getStepBase();