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://dom.spec.whatwg.org/#element and
8 * http://domparsing.spec.whatwg.org/ and
9 * http://dev.w3.org/csswg/cssom-view/ and
10 * http://www.w3.org/TR/selectors-api/
11 *
12 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
13 * liability, trademark and document use rules apply.
14 */
16 interface Element : Node {
17 /*
18 We haven't moved these from Node to Element like the spec wants.
20 [Throws]
21 readonly attribute DOMString? namespaceURI;
22 readonly attribute DOMString? prefix;
23 readonly attribute DOMString localName;
24 */
25 // Not [Constant] because it depends on which document we're in
26 [Pure]
27 readonly attribute DOMString tagName;
29 [Pure]
30 attribute DOMString id;
31 /*
32 FIXME Bug 810677 Move className from HTMLElement to Element
33 attribute DOMString className;
34 */
35 [Constant]
36 readonly attribute DOMTokenList? classList;
38 [SameObject]
39 readonly attribute MozNamedAttrMap attributes;
40 [Pure]
41 DOMString? getAttribute(DOMString name);
42 [Pure]
43 DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
44 [Throws]
45 void setAttribute(DOMString name, DOMString value);
46 [Throws]
47 void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
48 [Throws]
49 void removeAttribute(DOMString name);
50 [Throws]
51 void removeAttributeNS(DOMString? namespace, DOMString localName);
52 [Pure]
53 boolean hasAttribute(DOMString name);
54 [Pure]
55 boolean hasAttributeNS(DOMString? namespace, DOMString localName);
57 [Pure]
58 HTMLCollection getElementsByTagName(DOMString localName);
59 [Throws, Pure]
60 HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
61 [Pure]
62 HTMLCollection getElementsByClassName(DOMString classNames);
64 /**
65 * The ratio of font-size-inflated text font size to computed font
66 * size for this element. This will query the element for its primary frame,
67 * and then use this to get font size inflation information about the frame.
68 * This will be 1.0 if font size inflation is not enabled, and -1.0 if an
69 * error occurred during the retrieval of the font size inflation.
70 *
71 * @note The font size inflation ratio that is returned is actually the
72 * font size inflation data for the element's _primary frame_, not the
73 * element itself, but for most purposes, this should be sufficient.
74 */
75 [ChromeOnly]
76 readonly attribute float fontSizeInflation;
78 // Mozilla specific stuff
79 [Pure]
80 attribute EventHandler onwheel;
82 // Selectors API
83 /**
84 * Returns whether this element would be selected by the given selector
85 * string.
86 *
87 * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
88 */
89 [Throws, Pure]
90 boolean mozMatchesSelector(DOMString selector);
92 // Pointer events methods.
93 [Throws, Pref="dom.w3c_pointer_events.enabled"]
94 void setPointerCapture(long pointerId);
96 [Throws, Pref="dom.w3c_pointer_events.enabled"]
97 void releasePointerCapture(long pointerId);
99 // Proprietary extensions
100 /**
101 * Set this during a mousedown event to grab and retarget all mouse events
102 * to this element until the mouse button is released or releaseCapture is
103 * called. If retargetToElement is true, then all events are targetted at
104 * this element. If false, events can also fire at descendants of this
105 * element.
106 *
107 */
108 void setCapture(optional boolean retargetToElement = false);
110 /**
111 * If this element has captured the mouse, release the capture. If another
112 * element has captured the mouse, this method has no effect.
113 */
114 void releaseCapture();
116 // Mozilla extensions
117 /**
118 * Requests that this element be made the full-screen element, as per the DOM
119 * full-screen api.
120 *
121 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
122 */
123 void mozRequestFullScreen();
125 /**
126 * Requests that this element be made the pointer-locked element, as per the DOM
127 * pointer lock api.
128 *
129 * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
130 */
131 void mozRequestPointerLock();
133 // Obsolete methods.
134 Attr? getAttributeNode(DOMString name);
135 [Throws]
136 Attr? setAttributeNode(Attr newAttr);
137 [Throws]
138 Attr? removeAttributeNode(Attr oldAttr);
139 Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
140 [Throws]
141 Attr? setAttributeNodeNS(Attr newAttr);
143 [ChromeOnly]
144 /**
145 * Scrolls the element by (dx, dy) CSS pixels without doing any
146 * layout flushing.
147 */
148 boolean scrollByNoFlush(long dx, long dy);
149 };
151 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
152 partial interface Element {
153 DOMRectList getClientRects();
154 DOMRect getBoundingClientRect();
156 // scrolling
157 void scrollIntoView();
158 void scrollIntoView(boolean top);
159 // None of the CSSOM attributes are [Pure], because they flush
160 attribute long scrollTop; // scroll on setting
161 attribute long scrollLeft; // scroll on setting
162 readonly attribute long scrollWidth;
163 readonly attribute long scrollHeight;
165 readonly attribute long clientTop;
166 readonly attribute long clientLeft;
167 readonly attribute long clientWidth;
168 readonly attribute long clientHeight;
170 // Mozilla specific stuff
171 /* The maximum offset that the element can be scrolled to
172 (i.e., the value that scrollLeft/scrollTop would be clamped to if they were
173 set to arbitrarily large values. */
174 readonly attribute long scrollTopMax;
175 readonly attribute long scrollLeftMax;
176 };
178 // http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
179 partial interface Element {
180 [Pref="dom.undo_manager.enabled"]
181 readonly attribute UndoManager? undoManager;
182 [SetterThrows,Pref="dom.undo_manager.enabled"]
183 attribute boolean undoScope;
184 };
186 // http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
187 partial interface Element {
188 [Pure,SetterThrows,TreatNullAs=EmptyString]
189 attribute DOMString innerHTML;
190 [Pure,SetterThrows,TreatNullAs=EmptyString]
191 attribute DOMString outerHTML;
192 [Throws]
193 void insertAdjacentHTML(DOMString position, DOMString text);
194 };
196 // http://www.w3.org/TR/selectors-api/#interface-definitions
197 partial interface Element {
198 [Throws, Pure]
199 Element? querySelector(DOMString selectors);
200 [Throws, Pure]
201 NodeList querySelectorAll(DOMString selectors);
202 };
204 // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-object
205 partial interface Element {
206 [Throws,Pref="dom.webcomponents.enabled"]
207 ShadowRoot createShadowRoot();
208 [Pref="dom.webcomponents.enabled"]
209 readonly attribute ShadowRoot? shadowRoot;
210 };
212 Element implements ChildNode;
213 Element implements NonDocumentTypeChildNode;
214 Element implements ParentNode;