1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/Element.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,214 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * http://dom.spec.whatwg.org/#element and 1.11 + * http://domparsing.spec.whatwg.org/ and 1.12 + * http://dev.w3.org/csswg/cssom-view/ and 1.13 + * http://www.w3.org/TR/selectors-api/ 1.14 + * 1.15 + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 1.16 + * liability, trademark and document use rules apply. 1.17 + */ 1.18 + 1.19 +interface Element : Node { 1.20 +/* 1.21 + We haven't moved these from Node to Element like the spec wants. 1.22 + 1.23 + [Throws] 1.24 + readonly attribute DOMString? namespaceURI; 1.25 + readonly attribute DOMString? prefix; 1.26 + readonly attribute DOMString localName; 1.27 +*/ 1.28 + // Not [Constant] because it depends on which document we're in 1.29 + [Pure] 1.30 + readonly attribute DOMString tagName; 1.31 + 1.32 + [Pure] 1.33 + attribute DOMString id; 1.34 +/* 1.35 + FIXME Bug 810677 Move className from HTMLElement to Element 1.36 + attribute DOMString className; 1.37 +*/ 1.38 + [Constant] 1.39 + readonly attribute DOMTokenList? classList; 1.40 + 1.41 + [SameObject] 1.42 + readonly attribute MozNamedAttrMap attributes; 1.43 + [Pure] 1.44 + DOMString? getAttribute(DOMString name); 1.45 + [Pure] 1.46 + DOMString? getAttributeNS(DOMString? namespace, DOMString localName); 1.47 + [Throws] 1.48 + void setAttribute(DOMString name, DOMString value); 1.49 + [Throws] 1.50 + void setAttributeNS(DOMString? namespace, DOMString name, DOMString value); 1.51 + [Throws] 1.52 + void removeAttribute(DOMString name); 1.53 + [Throws] 1.54 + void removeAttributeNS(DOMString? namespace, DOMString localName); 1.55 + [Pure] 1.56 + boolean hasAttribute(DOMString name); 1.57 + [Pure] 1.58 + boolean hasAttributeNS(DOMString? namespace, DOMString localName); 1.59 + 1.60 + [Pure] 1.61 + HTMLCollection getElementsByTagName(DOMString localName); 1.62 + [Throws, Pure] 1.63 + HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); 1.64 + [Pure] 1.65 + HTMLCollection getElementsByClassName(DOMString classNames); 1.66 + 1.67 + /** 1.68 + * The ratio of font-size-inflated text font size to computed font 1.69 + * size for this element. This will query the element for its primary frame, 1.70 + * and then use this to get font size inflation information about the frame. 1.71 + * This will be 1.0 if font size inflation is not enabled, and -1.0 if an 1.72 + * error occurred during the retrieval of the font size inflation. 1.73 + * 1.74 + * @note The font size inflation ratio that is returned is actually the 1.75 + * font size inflation data for the element's _primary frame_, not the 1.76 + * element itself, but for most purposes, this should be sufficient. 1.77 + */ 1.78 + [ChromeOnly] 1.79 + readonly attribute float fontSizeInflation; 1.80 + 1.81 + // Mozilla specific stuff 1.82 + [Pure] 1.83 + attribute EventHandler onwheel; 1.84 + 1.85 + // Selectors API 1.86 + /** 1.87 + * Returns whether this element would be selected by the given selector 1.88 + * string. 1.89 + * 1.90 + * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector> 1.91 + */ 1.92 + [Throws, Pure] 1.93 + boolean mozMatchesSelector(DOMString selector); 1.94 + 1.95 + // Pointer events methods. 1.96 + [Throws, Pref="dom.w3c_pointer_events.enabled"] 1.97 + void setPointerCapture(long pointerId); 1.98 + 1.99 + [Throws, Pref="dom.w3c_pointer_events.enabled"] 1.100 + void releasePointerCapture(long pointerId); 1.101 + 1.102 + // Proprietary extensions 1.103 + /** 1.104 + * Set this during a mousedown event to grab and retarget all mouse events 1.105 + * to this element until the mouse button is released or releaseCapture is 1.106 + * called. If retargetToElement is true, then all events are targetted at 1.107 + * this element. If false, events can also fire at descendants of this 1.108 + * element. 1.109 + * 1.110 + */ 1.111 + void setCapture(optional boolean retargetToElement = false); 1.112 + 1.113 + /** 1.114 + * If this element has captured the mouse, release the capture. If another 1.115 + * element has captured the mouse, this method has no effect. 1.116 + */ 1.117 + void releaseCapture(); 1.118 + 1.119 + // Mozilla extensions 1.120 + /** 1.121 + * Requests that this element be made the full-screen element, as per the DOM 1.122 + * full-screen api. 1.123 + * 1.124 + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> 1.125 + */ 1.126 + void mozRequestFullScreen(); 1.127 + 1.128 + /** 1.129 + * Requests that this element be made the pointer-locked element, as per the DOM 1.130 + * pointer lock api. 1.131 + * 1.132 + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> 1.133 + */ 1.134 + void mozRequestPointerLock(); 1.135 + 1.136 + // Obsolete methods. 1.137 + Attr? getAttributeNode(DOMString name); 1.138 + [Throws] 1.139 + Attr? setAttributeNode(Attr newAttr); 1.140 + [Throws] 1.141 + Attr? removeAttributeNode(Attr oldAttr); 1.142 + Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName); 1.143 + [Throws] 1.144 + Attr? setAttributeNodeNS(Attr newAttr); 1.145 + 1.146 + [ChromeOnly] 1.147 + /** 1.148 + * Scrolls the element by (dx, dy) CSS pixels without doing any 1.149 + * layout flushing. 1.150 + */ 1.151 + boolean scrollByNoFlush(long dx, long dy); 1.152 +}; 1.153 + 1.154 +// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface 1.155 +partial interface Element { 1.156 + DOMRectList getClientRects(); 1.157 + DOMRect getBoundingClientRect(); 1.158 + 1.159 + // scrolling 1.160 + void scrollIntoView(); 1.161 + void scrollIntoView(boolean top); 1.162 + // None of the CSSOM attributes are [Pure], because they flush 1.163 + attribute long scrollTop; // scroll on setting 1.164 + attribute long scrollLeft; // scroll on setting 1.165 + readonly attribute long scrollWidth; 1.166 + readonly attribute long scrollHeight; 1.167 + 1.168 + readonly attribute long clientTop; 1.169 + readonly attribute long clientLeft; 1.170 + readonly attribute long clientWidth; 1.171 + readonly attribute long clientHeight; 1.172 + 1.173 + // Mozilla specific stuff 1.174 + /* The maximum offset that the element can be scrolled to 1.175 + (i.e., the value that scrollLeft/scrollTop would be clamped to if they were 1.176 + set to arbitrarily large values. */ 1.177 + readonly attribute long scrollTopMax; 1.178 + readonly attribute long scrollLeftMax; 1.179 +}; 1.180 + 1.181 +// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html 1.182 +partial interface Element { 1.183 + [Pref="dom.undo_manager.enabled"] 1.184 + readonly attribute UndoManager? undoManager; 1.185 + [SetterThrows,Pref="dom.undo_manager.enabled"] 1.186 + attribute boolean undoScope; 1.187 +}; 1.188 + 1.189 +// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface 1.190 +partial interface Element { 1.191 + [Pure,SetterThrows,TreatNullAs=EmptyString] 1.192 + attribute DOMString innerHTML; 1.193 + [Pure,SetterThrows,TreatNullAs=EmptyString] 1.194 + attribute DOMString outerHTML; 1.195 + [Throws] 1.196 + void insertAdjacentHTML(DOMString position, DOMString text); 1.197 +}; 1.198 + 1.199 +// http://www.w3.org/TR/selectors-api/#interface-definitions 1.200 +partial interface Element { 1.201 + [Throws, Pure] 1.202 + Element? querySelector(DOMString selectors); 1.203 + [Throws, Pure] 1.204 + NodeList querySelectorAll(DOMString selectors); 1.205 +}; 1.206 + 1.207 +// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-object 1.208 +partial interface Element { 1.209 + [Throws,Pref="dom.webcomponents.enabled"] 1.210 + ShadowRoot createShadowRoot(); 1.211 + [Pref="dom.webcomponents.enabled"] 1.212 + readonly attribute ShadowRoot? shadowRoot; 1.213 +}; 1.214 + 1.215 +Element implements ChildNode; 1.216 +Element implements NonDocumentTypeChildNode; 1.217 +Element implements ParentNode;