dom/interfaces/core/nsIDOMElement.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/interfaces/core/nsIDOMElement.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,217 @@
     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
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsIDOMNode.idl"
    1.10 +
    1.11 +interface nsIDOMMozNamedAttrMap;
    1.12 +
    1.13 +/**
    1.14 + * The nsIDOMElement interface represents an element in an HTML or 
    1.15 + * XML document. 
    1.16 + *
    1.17 + * For more information on this interface please see 
    1.18 + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element
    1.19 + */
    1.20 +
    1.21 +[scriptable, uuid(989422ef-120d-4d29-8a56-6aa2505a8b02)]
    1.22 +interface nsIDOMElement : nsIDOMNode
    1.23 +{
    1.24 +  readonly attribute DOMString        tagName;
    1.25 +
    1.26 +  /**
    1.27 +   * Returns a DOMTokenList object reflecting the class attribute.
    1.28 +   */
    1.29 +  readonly attribute nsISupports classList;
    1.30 +
    1.31 +  readonly attribute nsIDOMMozNamedAttrMap attributes;
    1.32 +  DOMString          getAttribute(in DOMString name);
    1.33 +  DOMString          getAttributeNS(in DOMString namespaceURI, 
    1.34 +                                    in DOMString localName);
    1.35 +  void               setAttribute(in DOMString name, 
    1.36 +                                  in DOMString value);
    1.37 +  void               setAttributeNS(in DOMString namespaceURI, 
    1.38 +                                    in DOMString qualifiedName, 
    1.39 +                                    in DOMString value);
    1.40 +  void               removeAttribute(in DOMString name);
    1.41 +  void               removeAttributeNS(in DOMString namespaceURI, 
    1.42 +                                       in DOMString localName);
    1.43 +  boolean            hasAttribute(in DOMString name);
    1.44 +  boolean            hasAttributeNS(in DOMString namespaceURI, 
    1.45 +                                    in DOMString localName);
    1.46 +
    1.47 +  // Obsolete methods.
    1.48 +  nsIDOMAttr         getAttributeNode(in DOMString name);
    1.49 +  nsIDOMAttr         setAttributeNode(in nsIDOMAttr newAttr);
    1.50 +  nsIDOMAttr         removeAttributeNode(in nsIDOMAttr oldAttr);
    1.51 +  nsIDOMAttr         getAttributeNodeNS(in DOMString namespaceURI, 
    1.52 +                                        in DOMString localName);
    1.53 +  nsIDOMAttr         setAttributeNodeNS(in nsIDOMAttr newAttr)
    1.54 +                                        raises(DOMException);
    1.55 +
    1.56 +  nsIDOMHTMLCollection getElementsByTagName(in DOMString name);
    1.57 +  nsIDOMHTMLCollection getElementsByTagNameNS(in DOMString namespaceURI, 
    1.58 +                                              in DOMString localName);
    1.59 +  /**
    1.60 +   * Retrieve elements matching all classes listed in a
    1.61 +   * space-separated string.
    1.62 +   */
    1.63 +  nsIDOMHTMLCollection getElementsByClassName(in DOMString classes);
    1.64 +
    1.65 +  /**
    1.66 +   * Returns a live nsIDOMNodeList of the current child elements.
    1.67 +   */
    1.68 +  [binaryname(ChildElements)]
    1.69 +  readonly attribute nsIDOMNodeList children;
    1.70 +  /**
    1.71 +   * Similar as the attributes on nsIDOMNode, but navigates just elements
    1.72 +   * rather than all nodes.
    1.73 +   */
    1.74 +  readonly attribute nsIDOMElement firstElementChild;
    1.75 +  readonly attribute nsIDOMElement lastElementChild;
    1.76 +  readonly attribute nsIDOMElement previousElementSibling;
    1.77 +  readonly attribute nsIDOMElement nextElementSibling;
    1.78 +  /**
    1.79 +   * Returns the number of child nodes that are nsIDOMElements.
    1.80 +   */
    1.81 +  readonly attribute unsigned long childElementCount;
    1.82 +
    1.83 +  [binaryname(MozRemove)]
    1.84 +  void remove();
    1.85 +
    1.86 +  // CSSOM View
    1.87 +  /**
    1.88 +   * Retrieve a list of rectangles, one for each CSS border-box associated with
    1.89 +   * the element. The coordinates are in CSS pixels, and relative to
    1.90 +   * the top-left of the document's viewport, unless the document
    1.91 +   * has an SVG foreignobject ancestor, in which case the coordinates are
    1.92 +   * relative to the top-left of the content box of the nearest SVG foreignobject
    1.93 +   * ancestor. The coordinates are calculated as if every scrollable element
    1.94 +   * is scrolled to its default position.
    1.95 +   *
    1.96 +   * Note: the boxes of overflowing children do not affect these rectangles.
    1.97 +   * Note: some elements have empty CSS boxes. Those return empty rectangles,
    1.98 +   * but the coordinates may still be meaningful.
    1.99 +   * Note: some elements have no CSS boxes (including display:none elements,
   1.100 +   * HTML AREA elements, and SVG elements that do not render). Those return
   1.101 +   * an empty list.
   1.102 +   */
   1.103 +  nsIDOMClientRectList getClientRects();
   1.104 +
   1.105 +  /**
   1.106 +   * Returns the union of all rectangles in the getClientRects() list. Empty
   1.107 +   * rectangles are ignored, except that if all rectangles are empty,
   1.108 +   * we return an empty rectangle positioned at the top-left of the first
   1.109 +   * rectangle in getClientRects().
   1.110 +   */
   1.111 +  nsIDOMClientRect getBoundingClientRect();
   1.112 +
   1.113 +  /**
   1.114 +   * The vertical scroll position of the element, or 0 if the element is not
   1.115 +   * scrollable. This property may be assigned a value to change the
   1.116 +   * vertical scroll position.
   1.117 +   */
   1.118 +  attribute long             scrollTop;
   1.119 +
   1.120 +  /**
   1.121 +   * The horizontal scroll position of the element, or 0 if the element is not
   1.122 +   * scrollable. This property may be assigned a value to change the
   1.123 +   * horizontal scroll position.
   1.124 +   */
   1.125 +  attribute long             scrollLeft;
   1.126 +
   1.127 +  /**
   1.128 +   * The width of the scrollable area of the element. If the element is not
   1.129 +   * scrollable, scrollWidth is equivalent to the offsetWidth.
   1.130 +   */
   1.131 +  readonly attribute long             scrollWidth;
   1.132 +
   1.133 +  /**
   1.134 +   * The height of the scrollable area of the element. If the element is not
   1.135 +   * scrollable, scrollHeight is equivalent to the offsetHeight.
   1.136 +   */
   1.137 +  readonly attribute long             scrollHeight;
   1.138 +
   1.139 +  /**
   1.140 +   * The height in CSS pixels of the element's top border.
   1.141 +   */
   1.142 +  readonly attribute long             clientTop;
   1.143 +
   1.144 +  /**
   1.145 +   * The width in CSS pixels of the element's left border and scrollbar
   1.146 +   * if it is present on the left side.
   1.147 +   */
   1.148 +  readonly attribute long             clientLeft;
   1.149 +
   1.150 +  /**
   1.151 +   * The height in CSS pixels of the element's padding box. If the element is
   1.152 +   * scrollable, the scroll bars are included inside this width.
   1.153 +   */
   1.154 +  readonly attribute long             clientWidth;
   1.155 +
   1.156 +  /**
   1.157 +   * The width in CSS pixels of the element's padding box. If the element is
   1.158 +   * scrollable, the scroll bars are included inside this height.
   1.159 +   */
   1.160 +  readonly attribute long             clientHeight;
   1.161 +
   1.162 +  /* The maximum offset that the element can be scrolled to
   1.163 +     (i.e., the value that scrollLeft/scrollTop would be clamped to if they were
   1.164 +     set to arbitrarily large values. */
   1.165 +  readonly attribute long             scrollLeftMax;
   1.166 +  readonly attribute long             scrollTopMax;
   1.167 +
   1.168 +
   1.169 +  // Selectors API
   1.170 +  /**
   1.171 +   * Returns whether this element would be selected by the given selector
   1.172 +   * string.
   1.173 +   *
   1.174 +   * See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
   1.175 +   */
   1.176 +  boolean mozMatchesSelector([Null(Stringify)] in DOMString selector);
   1.177 +
   1.178 +
   1.179 +  // Proprietary extensions
   1.180 +  /**
   1.181 +   * Set this during a mousedown event to grab and retarget all mouse events
   1.182 +   * to this element until the mouse button is released or releaseCapture is
   1.183 +   * called. If retargetToElement is true, then all events are targetted at
   1.184 +   * this element. If false, events can also fire at descendants of this
   1.185 +   * element.
   1.186 +   * 
   1.187 +   */
   1.188 +  void setCapture([optional] in boolean retargetToElement);
   1.189 +
   1.190 +  /**
   1.191 +   * If this element has captured the mouse, release the capture. If another
   1.192 +   * element has captured the mouse, this method has no effect.
   1.193 +   */
   1.194 +  void releaseCapture();
   1.195 +
   1.196 +  // Mozilla extensions
   1.197 +  /**
   1.198 +   * Requests that this element be made the full-screen element, as per the DOM
   1.199 +   * full-screen api.
   1.200 +   *
   1.201 +   * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
   1.202 +   */
   1.203 +  void mozRequestFullScreen();
   1.204 +
   1.205 +  /**
   1.206 +   * Requests that this element be made the pointer-locked element, as per the DOM
   1.207 +   * pointer lock api.
   1.208 +   *
   1.209 +   * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
   1.210 +   */
   1.211 +  void mozRequestPointerLock();
   1.212 +
   1.213 +  /**
   1.214 +   * Return nodes that match a given CSS selector.
   1.215 +   *
   1.216 +   * @see <http://dev.w3.org/2006/webapi/selectors-api/>
   1.217 +   */
   1.218 +  nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors);
   1.219 +  nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors);
   1.220 +};

mercurial