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/.
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
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.
23 interface XULControllers;
26 InstrumentedProps=(capture,
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;
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;
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;
68 attribute boolean indeterminate;
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;
104 attribute object? valueAsDate;
106 attribute unrestricted double valueAsNumber;
107 [CEReactions, SetterThrows]
108 attribute unsigned long width;
111 undefined stepUp(optional long n = 1);
113 undefined stepDown(optional long n = 1);
116 readonly attribute boolean willValidate;
118 readonly attribute ValidityState validity;
120 readonly attribute DOMString validationMessage;
121 boolean checkValidity();
122 boolean reportValidity();
123 undefined setCustomValidity(DOMString error);
125 readonly attribute NodeList? labels;
130 attribute unsigned long? selectionStart;
132 attribute unsigned long? selectionEnd;
134 attribute DOMString? selectionDirection;
136 undefined setRangeText(DOMString replacement);
138 undefined setRangeText(DOMString replacement, unsigned long start,
139 unsigned long end, optional SelectionMode selectionMode = "preserve");
141 undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
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;
166 sequence<DOMString> mozGetFileNameArray();
169 undefined mozSetFileNameArray(sequence<DOMString> fileNames);
172 undefined mozSetFileArray(sequence<File> files);
174 // This method is meant to use for testing only.
176 undefined mozSetDirectory(DOMString directoryPath);
178 // This method is meant to use for testing only.
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);
189 readonly attribute boolean hasBeenTypePassword;
192 attribute DOMString previewValue;
194 // Last value entered by the user, not by a script.
195 // NOTE(emilio): As of right now some execCommand triggered changes might be
196 // considered interactive.
198 readonly attribute DOMString lastInteractiveValue;
201 // This function will return null if @autocomplete is not defined for the
203 AutocompleteInfo? getAutocompleteInfo();
206 // The reveal password state for a type=password control.
207 attribute boolean revealPassword;
210 interface mixin MozEditableElement {
211 // Returns an nsIEditor instance which is associated with the element.
212 // If the element can be associated with an editor but not yet created,
213 // this creates new one automatically.
214 [Pure, ChromeOnly, BinaryName="editorForBindings"]
215 readonly attribute nsIEditor? editor;
217 // Returns true if an nsIEditor instance has already been associated with
220 readonly attribute boolean hasEditor;
222 // This is set to true if "input" event should be fired with InputEvent on
223 // the element. Otherwise, i.e., if "input" event should be fired with
224 // Event, set to false.
226 readonly attribute boolean isInputEventTarget;
228 // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
229 // of the value change is closer to the normal user input, so 'change' event
230 // for example will be dispatched when focusing out the element.
231 [Func="IsChromeOrUAWidget", NeedsSubjectPrincipal]
232 undefined setUserInput(DOMString input);
235 HTMLInputElement includes MozEditableElement;
237 HTMLInputElement includes MozImageLoadingContent;
239 HTMLInputElement includes PopoverInvokerElement;
241 HTMLInputElement includes InvokerElement;
243 // https://wicg.github.io/entries-api/#idl-index
244 partial interface HTMLInputElement {
245 [Pref="dom.webkitBlink.filesystem.enabled", Frozen, Cached, Pure]
246 readonly attribute sequence<FileSystemEntry> webkitEntries;
248 [Pref="dom.webkitBlink.dirPicker.enabled", BinaryName="WebkitDirectoryAttr", SetterThrows]
249 attribute boolean webkitdirectory;
252 dictionary DateTimeValue {
260 partial interface HTMLInputElement {
262 DateTimeValue getDateTimeInputBoxValue();
265 readonly attribute Element? dateTimeBoxElement;
267 [ChromeOnly, BinaryName="getMinimumAsDouble"]
270 [ChromeOnly, BinaryName="getMaximumAsDouble"]
273 [Func="IsChromeOrUAWidget"]
274 undefined openDateTimePicker(optional DateTimeValue initialValue = {});
276 [Func="IsChromeOrUAWidget"]
277 undefined updateDateTimePicker(optional DateTimeValue value = {});
279 [Func="IsChromeOrUAWidget"]
280 undefined closeDateTimePicker();
282 [Func="IsChromeOrUAWidget"]
283 undefined setFocusState(boolean aIsFocused);
285 [Func="IsChromeOrUAWidget"]
286 undefined updateValidityState();
288 [Func="IsChromeOrUAWidget", BinaryName="getStepAsDouble"]
291 [Func="IsChromeOrUAWidget", BinaryName="getStepBaseAsDouble"]
292 double getStepBase();