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 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;
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;
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;
61 attribute boolean indeterminate;
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;
97 attribute object? valueAsDate;
99 attribute unrestricted double valueAsNumber;
100 [CEReactions, SetterThrows]
101 attribute unsigned long width;
104 undefined stepUp(optional long n = 1);
106 undefined stepDown(optional long n = 1);
109 readonly attribute boolean willValidate;
111 readonly attribute ValidityState validity;
113 readonly attribute DOMString validationMessage;
114 boolean checkValidity();
115 boolean reportValidity();
116 undefined setCustomValidity(DOMString error);
118 readonly attribute NodeList? labels;
123 attribute unsigned long? selectionStart;
125 attribute unsigned long? selectionEnd;
127 attribute DOMString? selectionDirection;
129 undefined setRangeText(DOMString replacement);
131 undefined setRangeText(DOMString replacement, unsigned long start,
132 unsigned long end, optional SelectionMode selectionMode = "preserve");
134 undefined setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
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;
159 sequence<DOMString> mozGetFileNameArray();
162 undefined mozSetFileNameArray(sequence<DOMString> fileNames);
165 undefined mozSetFileArray(sequence<File> files);
167 // This method is meant to use for testing only.
169 undefined mozSetDirectory(DOMString directoryPath);
171 // This method is meant to use for testing only.
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);
182 readonly attribute boolean hasBeenTypePassword;
185 attribute DOMString previewValue;
187 // A string indicating that the value of the element has been autofilled:
188 // either "filled", "preview" or "".
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.
196 readonly attribute DOMString lastInteractiveValue;
199 // This function will return null if @autocomplete is not defined for the
201 AutocompleteInfo? getAutocompleteInfo();
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
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.
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 {
258 partial interface HTMLInputElement {
260 DateTimeValue getDateTimeInputBoxValue();
263 readonly attribute Element? dateTimeBoxElement;
265 [ChromeOnly, BinaryName="getMinimumAsDouble"]
268 [ChromeOnly, BinaryName="getMaximumAsDouble"]
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"]
292 [Func="IsChromeOrUAWidget", BinaryName="getStepBaseAsDouble"]
293 double getStepBase();