dom/webidl/Element.webidl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial