Bug 1945643 - Update to mozilla-nimbus-schemas 2025.1.1 r=chumphreys
[gecko.git] / dom / webidl / HTMLInputElement.webidl
blobe039b1fc58633df9ff7debea7699696f04e4f5a4
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 interface HTMLInputElement : HTMLElement {
27   [HTMLConstructor] constructor();
29   [CEReactions, Pure, SetterThrows]
30            attribute DOMString accept;
31   [CEReactions, Pure, SetterThrows]
32            attribute DOMString alt;
33   [CEReactions, Pure, SetterThrows]
34            attribute DOMString autocomplete;
35   [CEReactions, Pure, SetterThrows, Pref="dom.capture.enabled"]
36            attribute DOMString capture;
37   [CEReactions, Pure, SetterThrows]
38            attribute boolean defaultChecked;
39   [Pure]
40            attribute boolean checked;
41   [CEReactions, Pure, SetterThrows]
42            attribute DOMString dirName;
43   [CEReactions, Pure, SetterThrows]
44            attribute boolean disabled;
45   readonly attribute HTMLFormElement? form;
46   [Pure]
47            attribute FileList? files;
48   [CEReactions, Pure, SetterThrows]
49            attribute DOMString formAction;
50   [CEReactions, Pure, SetterThrows]
51            attribute DOMString formEnctype;
52   [CEReactions, Pure, SetterThrows]
53            attribute DOMString formMethod;
54   [CEReactions, Pure, SetterThrows]
55            attribute boolean formNoValidate;
56   [CEReactions, Pure, SetterThrows]
57            attribute DOMString formTarget;
58   [CEReactions, Pure, SetterThrows]
59            attribute unsigned long height;
60   [Pure]
61            attribute boolean indeterminate;
62   [Pure]
63   readonly attribute HTMLDataListElement? list;
64   [CEReactions, Pure, SetterThrows]
65            attribute DOMString max;
66   [CEReactions, Pure, SetterThrows]
67            attribute long maxLength;
68   [CEReactions, Pure, SetterThrows]
69            attribute DOMString min;
70   [CEReactions, Pure, SetterThrows]
71            attribute long minLength;
72   [CEReactions, Pure, SetterThrows]
73            attribute boolean multiple;
74   [CEReactions, Pure, SetterThrows]
75            attribute DOMString name;
76   [CEReactions, Pure, SetterThrows]
77            attribute DOMString pattern;
78   [CEReactions, Pure, SetterThrows]
79            attribute DOMString placeholder;
80   [CEReactions, Pure, SetterThrows]
81            attribute boolean readOnly;
82   [CEReactions, Pure, SetterThrows]
83            attribute boolean required;
84   [CEReactions, Pure, SetterThrows]
85            attribute unsigned long size;
86   [CEReactions, Pure, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
87            attribute DOMString src;
88   [CEReactions, Pure, SetterThrows]
89            attribute DOMString step;
90   [CEReactions, Pure, SetterThrows]
91            attribute DOMString type;
92   [CEReactions, Pure, SetterThrows]
93            attribute DOMString defaultValue;
94   [CEReactions, Pure, SetterThrows, NeedsCallerType]
95            attribute [LegacyNullToEmptyString] DOMString value;
96   [Throws]
97            attribute object? valueAsDate;
98   [Pure, SetterThrows]
99            attribute unrestricted double valueAsNumber;
100   [CEReactions, SetterThrows]
101            attribute unsigned long width;
103   [Throws]
104   undefined stepUp(optional long n = 1);
105   [Throws]
106   undefined stepDown(optional long n = 1);
108   [Pure]
109   readonly attribute boolean willValidate;
110   [Pure]
111   readonly attribute ValidityState validity;
112   [Throws]
113   readonly attribute DOMString validationMessage;
114   boolean checkValidity();
115   boolean reportValidity();
116   undefined setCustomValidity(DOMString error);
118   readonly attribute NodeList? labels;
120   undefined select();
122   [Throws]
123            attribute unsigned long? selectionStart;
124   [Throws]
125            attribute unsigned long? selectionEnd;
126   [Throws]
127            attribute DOMString? selectionDirection;
128   [Throws]
129   undefined setRangeText(DOMString replacement);
130   [Throws]
131   undefined setRangeText(DOMString replacement, unsigned long start,
132     unsigned long end, optional SelectionMode selectionMode = "preserve");
133   [Throws]
134   undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
136   [Throws]
137   undefined showPicker();
139   // also has obsolete members
142 partial interface HTMLInputElement {
143   [CEReactions, Pure, SetterThrows]
144            attribute DOMString align;
145   [CEReactions, Pure, SetterThrows]
146            attribute DOMString useMap;
149 // Mozilla extensions
151 partial interface HTMLInputElement {
152   [GetterThrows, ChromeOnly]
153   readonly attribute XULControllers?       controllers;
154   // Binaryname because we have a FragmentOrElement function named "TextLength()".
155   [NeedsCallerType, BinaryName="inputTextLength"]
156   readonly attribute long                  textLength;
158   [Throws, ChromeOnly]
159   sequence<DOMString> mozGetFileNameArray();
161   [ChromeOnly, Throws]
162   undefined mozSetFileNameArray(sequence<DOMString> fileNames);
164   [ChromeOnly]
165   undefined mozSetFileArray(sequence<File> files);
167   // This method is meant to use for testing only.
168   [ChromeOnly, Throws]
169   undefined mozSetDirectory(DOMString directoryPath);
171   // This method is meant to use for testing only.
172   [ChromeOnly]
173   undefined mozSetDndFilesAndDirectories(sequence<(File or Directory)> list);
175   // This method is meant to use for testing only.
176   [ChromeOnly, NewObject]
177   Promise<sequence<(File or Directory)>> getFilesAndDirectories();
179   boolean mozIsTextField(boolean aExcludePassword);
181   [ChromeOnly]
182   readonly attribute boolean hasBeenTypePassword;
184   [ChromeOnly]
185   attribute DOMString previewValue;
187   // A string indicating that the value of the element has been autofilled:
188   // either "filled", "preview" or "".
189   [ChromeOnly]
190   attribute DOMString autofillState;
192   // Last value entered by the user, not by a script.
193   // NOTE(emilio): As of right now some execCommand triggered changes might be
194   // considered interactive.
195   [ChromeOnly]
196   readonly attribute DOMString lastInteractiveValue;
198   [ChromeOnly]
199   // This function will return null if @autocomplete is not defined for the
200   // current @type
201   AutocompleteInfo? getAutocompleteInfo();
203   [ChromeOnly]
204   // The reveal password state for a type=password control.
205   attribute boolean revealPassword;
208 interface mixin MozEditableElement {
209   // Returns an nsIEditor instance which is associated with the element.
210   // If the element can be associated with an editor but not yet created,
211   // this creates new one automatically.
212   [Pure, ChromeOnly, BinaryName="editorForBindings"]
213   readonly attribute nsIEditor? editor;
215   // Returns true if an nsIEditor instance has already been associated with
216   // the element.
217   [Pure, ChromeOnly]
218   readonly attribute boolean hasEditor;
220   // This is set to true if "input" event should be fired with InputEvent on
221   // the element.  Otherwise, i.e., if "input" event should be fired with
222   // Event, set to false.
223   [ChromeOnly]
224   readonly attribute boolean isInputEventTarget;
226   // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
227   // of the value change is closer to the normal user input, so 'change' event
228   // for example will be dispatched when focusing out the element.
229   [Func="IsChromeOrUAWidget", NeedsSubjectPrincipal]
230   undefined setUserInput(DOMString input);
233 HTMLInputElement includes MozEditableElement;
235 HTMLInputElement includes MozImageLoadingContent;
237 HTMLInputElement includes PopoverInvokerElement;
239 HTMLInputElement includes InvokerElement;
241 // https://wicg.github.io/entries-api/#idl-index
242 partial interface HTMLInputElement {
243   [Pref="dom.webkitBlink.filesystem.enabled", Frozen, Cached, Pure]
244   readonly attribute sequence<FileSystemEntry> webkitEntries;
246   [Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows]
247           attribute boolean webkitdirectory;
250 dictionary DateTimeValue {
251   long hour;
252   long minute;
253   long year;
254   long month;
255   long day;
258 partial interface HTMLInputElement {
259   [ChromeOnly]
260   DateTimeValue getDateTimeInputBoxValue();
262   [ChromeOnly]
263   readonly attribute Element? dateTimeBoxElement;
265   [ChromeOnly, BinaryName="getMinimumAsDouble"]
266   double getMinimum();
268   [ChromeOnly, BinaryName="getMaximumAsDouble"]
269   double getMaximum();
271   [Func="IsChromeOrUAWidget"]
272   undefined openDateTimePicker(optional DateTimeValue initialValue = {});
274   [Func="IsChromeOrUAWidget"]
275   undefined updateDateTimePicker(optional DateTimeValue value = {});
277   [Func="IsChromeOrUAWidget"]
278   undefined closeDateTimePicker();
280   [Func="IsChromeOrUAWidget"]
281   undefined setDateTimePickerState(boolean aIsOpen);
283   [Func="IsChromeOrUAWidget"]
284   undefined setFocusState(boolean aIsFocused);
286   [Func="IsChromeOrUAWidget"]
287   undefined updateValidityState();
289   [Func="IsChromeOrUAWidget", BinaryName="getStepAsDouble"]
290   double getStep();
292   [Func="IsChromeOrUAWidget", BinaryName="getStepBaseAsDouble"]
293   double getStepBase();