Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 *
10 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
11 * Opera Software ASA. You are granted a license to use, reproduce
12 * and create derivative works of this document.
13 */
15 enum SelectionMode {
16 "select",
17 "start",
18 "end",
19 "preserve",
20 };
22 interface nsIControllers;
24 interface HTMLInputElement : HTMLElement {
25 [Pure, SetterThrows]
26 attribute DOMString accept;
27 [Pure, SetterThrows]
28 attribute DOMString alt;
29 [Pure, SetterThrows]
30 attribute DOMString autocomplete;
31 [Pure, SetterThrows]
32 attribute boolean autofocus;
33 [Pure, SetterThrows]
34 attribute boolean defaultChecked;
35 [Pure]
36 attribute boolean checked;
37 // Bug 850337 - attribute DOMString dirName;
38 [Pure, SetterThrows]
39 attribute boolean disabled;
40 readonly attribute HTMLFormElement? form;
41 [Pure]
42 readonly attribute FileList? files;
43 [Throws, Pref="dom.input.dirpicker"]
44 void openDirectoryPicker();
45 [Pure, SetterThrows]
46 attribute DOMString formAction;
47 [Pure, SetterThrows]
48 attribute DOMString formEnctype;
49 [Pure, SetterThrows]
50 attribute DOMString formMethod;
51 [Pure, SetterThrows]
52 attribute boolean formNoValidate;
53 [Pure, SetterThrows]
54 attribute DOMString formTarget;
55 [Pure, SetterThrows]
56 attribute unsigned long height;
57 [Pure]
58 attribute boolean indeterminate;
59 [Pure, SetterThrows, Pref="dom.forms.inputmode"]
60 attribute DOMString inputMode;
61 [Pure]
62 readonly attribute HTMLElement? list;
63 [Pure, SetterThrows]
64 attribute DOMString max;
65 [Pure, SetterThrows]
66 attribute long maxLength;
67 [Pure, SetterThrows]
68 attribute DOMString min;
69 [Pure, SetterThrows]
70 attribute boolean multiple;
71 [Pure, SetterThrows]
72 attribute DOMString name;
73 [Pure, SetterThrows]
74 attribute DOMString pattern;
75 [Pure, SetterThrows]
76 attribute DOMString placeholder;
77 [Pure, SetterThrows]
78 attribute boolean readOnly;
79 [Pure, SetterThrows]
80 attribute boolean required;
81 [Pure, SetterThrows]
82 attribute unsigned long size;
83 [Pure, SetterThrows]
84 attribute DOMString src;
85 [Pure, SetterThrows]
86 attribute DOMString step;
87 [Pure, SetterThrows]
88 attribute DOMString type;
89 [Pure, SetterThrows]
90 attribute DOMString defaultValue;
91 [Pure, TreatNullAs=EmptyString, SetterThrows]
92 attribute DOMString value;
93 [Throws, Pref="dom.experimental_forms"]
94 attribute Date? valueAsDate;
95 [Pure, SetterThrows]
96 attribute unrestricted double valueAsNumber;
97 attribute unsigned long width;
99 [Throws]
100 void stepUp(optional long n = 1);
101 [Throws]
102 void stepDown(optional long n = 1);
104 [Pure]
105 readonly attribute boolean willValidate;
106 [Pure]
107 readonly attribute ValidityState validity;
108 [GetterThrows]
109 readonly attribute DOMString validationMessage;
110 boolean checkValidity();
111 void setCustomValidity(DOMString error);
113 // Bug 850365 readonly attribute NodeList labels;
115 void select();
117 [Throws]
118 // TODO: unsigned vs signed
119 attribute long selectionStart;
120 [Throws]
121 attribute long selectionEnd;
122 [Throws]
123 attribute DOMString selectionDirection;
124 [Throws]
125 void setRangeText(DOMString replacement);
126 [Throws]
127 void setRangeText(DOMString replacement, unsigned long start,
128 unsigned long end, optional SelectionMode selectionMode = "preserve");
130 // also has obsolete members
131 };
133 partial interface HTMLInputElement {
134 [Pure, SetterThrows]
135 attribute DOMString align;
136 [Pure, SetterThrows]
137 attribute DOMString useMap;
138 };
140 // Mozilla extensions
142 partial interface HTMLInputElement {
143 [Throws]
144 void setSelectionRange(long start, long end, optional DOMString direction);
146 [GetterThrows, ChromeOnly]
147 readonly attribute nsIControllers controllers;
148 [GetterThrows]
149 readonly attribute long textLength;
151 [ChromeOnly]
152 sequence<DOMString> mozGetFileNameArray();
154 [ChromeOnly]
155 void mozSetFileNameArray(sequence<DOMString> fileNames);
157 // Number controls (<input type=number>) have an anonymous text control
158 // (<input type=text>) in the anonymous shadow tree that they contain. On
159 // such an anonymous text control this property provides access to the
160 // number control that owns the text control. This is useful, for example,
161 // in code that looks at the currently focused element to make decisions
162 // about which IME to bring up. Such code needs to be able to check for any
163 // owning number control since it probably wants to bring up a number pad
164 // instead of the standard keyboard, even when the anonymous text control has
165 // focus.
166 [ChromeOnly]
167 readonly attribute HTMLInputElement? ownerNumberControl;
169 boolean mozIsTextField(boolean aExcludePassword);
170 };
172 partial interface HTMLInputElement {
173 // Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure
174 // to update this list if nsIDOMNSEditableElement changes.
176 [Pure, ChromeOnly]
177 readonly attribute nsIEditor? editor;
179 // This is similar to set .value on nsIDOMInput/TextAreaElements, but handling
180 // of the value change is closer to the normal user input, so 'change' event
181 // for example will be dispatched when focusing out the element.
182 [ChromeOnly]
183 void setUserInput(DOMString input);
184 };
186 [NoInterfaceObject]
187 interface MozPhonetic {
188 [Pure, ChromeOnly]
189 readonly attribute DOMString phonetic;
190 };
192 HTMLInputElement implements MozImageLoadingContent;
193 HTMLInputElement implements MozPhonetic;