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://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/
12 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
13 * liability, trademark and document use rules apply.
17 interface NamedNodeMap;
19 interface Element : Node {
21 We haven't moved these from Node to Element like the spec wants.
24 readonly attribute DOMString? namespaceURI;
25 readonly attribute DOMString? prefix;
26 readonly attribute DOMString localName;
28 readonly attribute DOMString tagName;
30 attribute DOMString id;
32 FIXME Bug 810677 Move className from HTMLElement to Element
33 attribute DOMString className;
35 readonly attribute DOMTokenList classList;
37 //readonly attribute Attr[] attributes;
38 DOMString? getAttribute(DOMString name);
39 DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
41 void setAttribute(DOMString name, DOMString value);
43 void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
45 void removeAttribute(DOMString name);
47 void removeAttributeNS(DOMString? namespace, DOMString localName);
48 boolean hasAttribute(DOMString name);
49 boolean hasAttributeNS(DOMString? namespace, DOMString localName);
51 HTMLCollection getElementsByTagName(DOMString localName);
53 HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
54 HTMLCollection getElementsByClassName(DOMString classNames);
56 readonly attribute HTMLCollection children;
57 readonly attribute Element? firstElementChild;
58 readonly attribute Element? lastElementChild;
59 readonly attribute Element? previousElementSibling;
60 readonly attribute Element? nextElementSibling;
61 readonly attribute unsigned long childElementCount;
65 FIXME We haven't implemented these yet.
67 void prepend((Node or DOMString)... nodes);
68 void append((Node or DOMString)... nodes);
69 void before((Node or DOMString)... nodes);
70 void after((Node or DOMString)... nodes);
71 void replace((Node or DOMString)... nodes);
75 // Mozilla specific stuff
79 * Returns whether this element would be selected by the given selector
82 * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
85 boolean mozMatchesSelector(DOMString selector);
87 // Proprietary extensions
89 * Set this during a mousedown event to grab and retarget all mouse events
90 * to this element until the mouse button is released or releaseCapture is
91 * called. If retargetToElement is true, then all events are targetted at
92 * this element. If false, events can also fire at descendants of this
96 void setCapture(optional boolean retargetToElement = false);
99 * If this element has captured the mouse, release the capture. If another
100 * element has captured the mouse, this method has no effect.
102 void releaseCapture();
104 // Mozilla extensions
106 * Requests that this element be made the full-screen element, as per the DOM
109 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
111 void mozRequestFullScreen();
114 * Requests that this element be made the pointer-locked element, as per the DOM
117 * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
119 void mozRequestPointerLock();
122 Attr getAttributeNode(DOMString name);
124 Attr setAttributeNode(Attr newAttr);
126 Attr removeAttributeNode(Attr oldAttr);
128 Attr getAttributeNodeNS(DOMString namespaceURI, DOMString localName);
130 Attr setAttributeNodeNS(Attr newAttr);
134 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
135 partial interface Element {
138 ClientRectList getClientRects();
139 ClientRect getBoundingClientRect();
142 void scrollIntoView(optional boolean top = true);
143 attribute long scrollTop; // scroll on setting
144 attribute long scrollLeft; // scroll on setting
145 readonly attribute long scrollWidth;
146 readonly attribute long scrollHeight;
148 readonly attribute long clientTop;
149 readonly attribute long clientLeft;
150 readonly attribute long clientWidth;
151 readonly attribute long clientHeight;
153 // Mozilla specific stuff
154 /* The maximum offset that the element can be scrolled to
155 (i.e., the value that scrollLeft/scrollTop would be clamped to if they were
156 set to arbitrarily large values. */
157 readonly attribute long scrollTopMax;
158 readonly attribute long scrollLeftMax;
162 enum insertAdjacentHTMLPosition {
169 // http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
170 partial interface Element {
172 attribute DOMString innerHTML;
174 attribute DOMString outerHTML;
176 void insertAdjacentHTML(insertAdjacentHTMLPosition position, DOMString text);
179 // http://www.w3.org/TR/selectors-api/#interface-definitions
180 partial interface Element {
183 Element? querySelector(DOMString selectors);
185 NodeList querySelectorAll(DOMString selectors);