dom/interfaces/core/nsIDOMDocument.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsIDOMNode.idl"
michael@0 7
michael@0 8 %{ C++
michael@0 9 #include "jspubtd.h"
michael@0 10
michael@0 11 // windows.h #defines CreateEvent
michael@0 12 #ifdef CreateEvent
michael@0 13 #undef CreateEvent
michael@0 14 #endif
michael@0 15 %}
michael@0 16
michael@0 17 interface nsIDOMNodeIterator;
michael@0 18 interface nsIDOMNodeFilter;
michael@0 19 interface nsIDOMTreeWalker;
michael@0 20 interface nsIDOMLocation;
michael@0 21
michael@0 22 /**
michael@0 23 * The nsIDOMDocument interface represents the entire HTML or XML document.
michael@0 24 * Conceptually, it is the root of the document tree, and provides the
michael@0 25 * primary access to the document's data.
michael@0 26 * Since elements, text nodes, comments, processing instructions, etc.
michael@0 27 * cannot exist outside the context of a Document, the nsIDOMDocument
michael@0 28 * interface also contains the factory methods needed to create these
michael@0 29 * objects.
michael@0 30 *
michael@0 31 * For more information on this interface please see
michael@0 32 * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
michael@0 33 */
michael@0 34
michael@0 35 [scriptable, uuid(d24d1118-a527-4d5a-9c4e-fb07dfc2fc27)]
michael@0 36 interface nsIDOMDocument : nsIDOMNode
michael@0 37 {
michael@0 38 readonly attribute nsIDOMDocumentType doctype;
michael@0 39 readonly attribute nsIDOMDOMImplementation implementation;
michael@0 40 readonly attribute nsIDOMElement documentElement;
michael@0 41 nsIDOMElement createElement([Null(Stringify)] in DOMString tagName)
michael@0 42 raises(DOMException);
michael@0 43 nsIDOMDocumentFragment createDocumentFragment();
michael@0 44 nsIDOMText createTextNode(in DOMString data);
michael@0 45 nsIDOMComment createComment(in DOMString data);
michael@0 46 nsIDOMCDATASection createCDATASection(in DOMString data)
michael@0 47 raises(DOMException);
michael@0 48 nsIDOMProcessingInstruction createProcessingInstruction(in DOMString target,
michael@0 49 in DOMString data)
michael@0 50 raises(DOMException);
michael@0 51 nsIDOMAttr createAttribute(in DOMString name)
michael@0 52 raises(DOMException);
michael@0 53 nsIDOMNodeList getElementsByTagName(in DOMString tagname);
michael@0 54
michael@0 55 // Introduced in DOM Level 2:
michael@0 56 [optional_argc] nsIDOMNode importNode(in nsIDOMNode importedNode,
michael@0 57 [optional] in boolean deep)
michael@0 58 raises(DOMException);
michael@0 59 // Introduced in DOM Level 2:
michael@0 60 nsIDOMElement createElementNS(in DOMString namespaceURI,
michael@0 61 [Null(Stringify)] in DOMString qualifiedName)
michael@0 62 raises(DOMException);
michael@0 63 // Introduced in DOM Level 2:
michael@0 64 nsIDOMAttr createAttributeNS(in DOMString namespaceURI,
michael@0 65 in DOMString qualifiedName)
michael@0 66 raises(DOMException);
michael@0 67 // Introduced in DOM Level 2:
michael@0 68 nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI,
michael@0 69 in DOMString localName);
michael@0 70 // Introduced in DOM Level 2:
michael@0 71 nsIDOMElement getElementById(in DOMString elementId);
michael@0 72 // Introduced in DOM Level 3:
michael@0 73 readonly attribute DOMString inputEncoding;
michael@0 74 // Introduced in DOM Level 3:
michael@0 75 readonly attribute DOMString documentURI;
michael@0 76 // Alias introduced for all documents in recent DOM standards
michael@0 77 readonly attribute DOMString URL;
michael@0 78 // Introduced in DOM Level 3:
michael@0 79 nsIDOMNode adoptNode(in nsIDOMNode source)
michael@0 80 raises(DOMException);
michael@0 81
michael@0 82 /**
michael@0 83 * Create a range
michael@0 84 *
michael@0 85 * @see http://html5.org/specs/dom-range.html#dom-document-createrange
michael@0 86 */
michael@0 87 nsIDOMRange createRange();
michael@0 88
michael@0 89 [optional_argc] nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root,
michael@0 90 [optional] in unsigned long whatToShow,
michael@0 91 [optional] in nsIDOMNodeFilter filter)
michael@0 92 raises(DOMException);
michael@0 93 [optional_argc] nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root,
michael@0 94 [optional] in unsigned long whatToShow,
michael@0 95 [optional] in nsIDOMNodeFilter filter)
michael@0 96 raises(DOMException);
michael@0 97
michael@0 98 nsIDOMEvent createEvent(in DOMString eventType)
michael@0 99 raises(DOMException);
michael@0 100
michael@0 101
michael@0 102 // HTML
michael@0 103 /**
michael@0 104 * The window associated with this document.
michael@0 105 *
michael@0 106 * @see <http://www.whatwg.org/html/#dom-document-defaultview>
michael@0 107 */
michael@0 108 readonly attribute nsIDOMWindow defaultView;
michael@0 109
michael@0 110 /**
michael@0 111 * @see <http://www.whatwg.org/html/#dom-document-characterset>
michael@0 112 */
michael@0 113 readonly attribute DOMString characterSet;
michael@0 114 /**
michael@0 115 * @see <http://www.whatwg.org/html/#dom-document-dir>
michael@0 116 */
michael@0 117 attribute DOMString dir;
michael@0 118
michael@0 119 /**
michael@0 120 * @see <http://www.whatwg.org/html/#dom-document-location>
michael@0 121 */
michael@0 122 readonly attribute nsIDOMLocation location;
michael@0 123
michael@0 124 /**
michael@0 125 * @see <http://www.whatwg.org/html/#document.title>
michael@0 126 */
michael@0 127 attribute DOMString title;
michael@0 128
michael@0 129 /**
michael@0 130 * @see <http://www.whatwg.org/html/#dom-document-readystate>
michael@0 131 */
michael@0 132 readonly attribute DOMString readyState;
michael@0 133 /**
michael@0 134 * @see <http://www.whatwg.org/html/#dom-document-lastmodified>
michael@0 135 */
michael@0 136 readonly attribute DOMString lastModified;
michael@0 137 /**
michael@0 138 * @see <http://www.whatwg.org/html/#dom-document-referrer>
michael@0 139 */
michael@0 140 readonly attribute DOMString referrer;
michael@0 141
michael@0 142 /**
michael@0 143 * @see <http://www.whatwg.org/html/#dom-document-hasfocus>
michael@0 144 */
michael@0 145 boolean hasFocus();
michael@0 146
michael@0 147 /**
michael@0 148 * @see <http://www.whatwg.org/html/#dom-document-activeelement>
michael@0 149 */
michael@0 150 readonly attribute nsIDOMElement activeElement;
michael@0 151
michael@0 152 /**
michael@0 153 * Retrieve elements matching all classes listed in a
michael@0 154 * space-separated string.
michael@0 155 *
michael@0 156 * @see <http://www.whatwg.org/html/#dom-document-getelementsbyclassname>
michael@0 157 */
michael@0 158 nsIDOMNodeList getElementsByClassName(in DOMString classes);
michael@0 159
michael@0 160
michael@0 161 // CSSOM
michael@0 162 /**
michael@0 163 * @see <http://dev.w3.org/csswg/cssom/#dom-document-stylesheets>
michael@0 164 */
michael@0 165 readonly attribute nsIDOMStyleSheetList styleSheets;
michael@0 166
michael@0 167 /**
michael@0 168 * This attribute must return the preferred style sheet set as set by the
michael@0 169 * author. It is determined from the order of style sheet declarations and
michael@0 170 * the Default-Style HTTP headers, as eventually defined elsewhere in the Web
michael@0 171 * Apps 1.0 specification. If there is no preferred style sheet set, this
michael@0 172 * attribute must return the empty string. The case of this attribute must
michael@0 173 * exactly match the case given by the author where the preferred style sheet
michael@0 174 * is specified or implied. This attribute must never return null.
michael@0 175 *
michael@0 176 * @see <http://dev.w3.org/csswg/cssom/#dom-document-preferredStyleSheetSet>
michael@0 177 */
michael@0 178 readonly attribute DOMString preferredStyleSheetSet;
michael@0 179
michael@0 180 /**
michael@0 181 * This attribute indicates which style sheet set is in use. This attribute
michael@0 182 * is live; changing the disabled attribute on style sheets directly will
michael@0 183 * change the value of this attribute.
michael@0 184 *
michael@0 185 * If all the sheets that are enabled and have a title have the same title
michael@0 186 * (by case-sensitive comparisons) then the value of this attribute must be
michael@0 187 * exactly equal to the title of the first enabled style sheet with a title
michael@0 188 * in the styleSheets list. Otherwise, if style sheets from different sets
michael@0 189 * are enabled, then the return value must be null (there is no way to
michael@0 190 * determine what the currently selected style sheet set is in those
michael@0 191 * conditions). Otherwise, either all style sheets that have a title are
michael@0 192 * disabled, or there are no alternate style sheets, and
michael@0 193 * selectedStyleSheetSet must return the empty string.
michael@0 194 *
michael@0 195 * Setting this attribute to the null value must have no effect.
michael@0 196 *
michael@0 197 * Setting this attribute to a non-null value must call
michael@0 198 * enableStyleSheetsForSet() with that value as the function's argument, and
michael@0 199 * set lastStyleSheetSet to that value.
michael@0 200 *
michael@0 201 * From the DOM's perspective, all views have the same
michael@0 202 * selectedStyleSheetSet. If a UA supports multiple views with different
michael@0 203 * selected alternate style sheets, then this attribute (and the StyleSheet
michael@0 204 * interface's disabled attribute) must return and set the value for the
michael@0 205 * default view.
michael@0 206 *
michael@0 207 * @see <http://dev.w3.org/csswg/cssom/#dom-document-selectedStyleSheetSet>
michael@0 208 */
michael@0 209 [binaryname(MozSelectedStyleSheetSet)]
michael@0 210 attribute DOMString selectedStyleSheetSet;
michael@0 211
michael@0 212 /*
michael@0 213 * This property must initially have the value null. Its value changes when
michael@0 214 * the selectedStyleSheetSet attribute is set.
michael@0 215 *
michael@0 216 * @see <http://dev.w3.org/csswg/cssom/#dom-document-lastStyleSheetSet>
michael@0 217 */
michael@0 218 readonly attribute DOMString lastStyleSheetSet;
michael@0 219
michael@0 220 /**
michael@0 221 * This must return the live list of the currently available style sheet
michael@0 222 * sets. This list is constructed by enumerating all the style sheets for
michael@0 223 * this document available to the implementation, in the order they are
michael@0 224 * listed in the styleSheets attribute, adding the title of each style sheet
michael@0 225 * with a title to the list, avoiding duplicates by dropping titles that
michael@0 226 * match (case-sensitively) titles that have already been added to the
michael@0 227 * list.
michael@0 228 *
michael@0 229 * @see <http://dev.w3.org/csswg/cssom/#dom-document-styleSheetSets>
michael@0 230 */
michael@0 231 readonly attribute nsISupports styleSheetSets;
michael@0 232
michael@0 233 /**
michael@0 234 * Calling this method must change the disabled attribute on each StyleSheet
michael@0 235 * object with a title attribute with a length greater than 0 in the
michael@0 236 * styleSheets attribute, so that all those whose title matches the name
michael@0 237 * argument are enabled, and all others are disabled. Title matches must be
michael@0 238 * case-sensitive. Calling this method with the empty string disables all
michael@0 239 * alternate and preferred style sheets (but does not change the state of
michael@0 240 * persistent style sheets, that is those with no title attribute).
michael@0 241 *
michael@0 242 * Calling this method with a null value must have no effect.
michael@0 243 *
michael@0 244 * Style sheets that do not have a title are never affected by this
michael@0 245 * method. This method does not change the values of the lastStyleSheetSet or
michael@0 246 * preferredStyleSheetSet attributes.
michael@0 247 *
michael@0 248 * @see <http://dev.w3.org/csswg/cssom/#dom-document-enableStyleSheetsForSet>
michael@0 249 */
michael@0 250 [binaryname(MozEnableStyleSheetsForSet)]
michael@0 251 void enableStyleSheetsForSet(in DOMString name);
michael@0 252
michael@0 253
michael@0 254 // CSSOM-View
michael@0 255 /**
michael@0 256 * Returns the element from the caller's document at the given point,
michael@0 257 * relative to the upper-left-most point in the (possibly scrolled)
michael@0 258 * window or frame.
michael@0 259 *
michael@0 260 * If the element at the given point belongs to another document (such as
michael@0 261 * an iframe's subdocument), the element in the calling document's DOM
michael@0 262 * (e.g. the iframe) is returned. If the element at the given point is
michael@0 263 * anonymous or XBL generated content, such as a textbox's scrollbars, then
michael@0 264 * the first non-anonymous parent element (that is, the textbox) is returned.
michael@0 265 *
michael@0 266 * This method returns null if either coordinate is negative, or if the
michael@0 267 * specified point lies outside the visible bounds of the document.
michael@0 268 *
michael@0 269 * Callers from XUL documents should wait until the onload event has fired
michael@0 270 * before calling this method.
michael@0 271 *
michael@0 272 * @see <http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint>
michael@0 273 */
michael@0 274 nsIDOMElement elementFromPoint(in float x, in float y);
michael@0 275
michael@0 276
michael@0 277 // Mozilla extensions
michael@0 278 /**
michael@0 279 * @see <https://developer.mozilla.org/en/DOM/document.contentType>
michael@0 280 */
michael@0 281 readonly attribute DOMString contentType;
michael@0 282
michael@0 283 /**
michael@0 284 * True if this document is synthetic : stand alone image, video, audio file,
michael@0 285 * etc.
michael@0 286 */
michael@0 287 readonly attribute boolean mozSyntheticDocument;
michael@0 288
michael@0 289 /**
michael@0 290 * Returns the script element whose script is currently being processed.
michael@0 291 *
michael@0 292 * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
michael@0 293 */
michael@0 294 readonly attribute nsIDOMElement currentScript;
michael@0 295
michael@0 296 /**
michael@0 297 * Release the current mouse capture if it is on an element within this
michael@0 298 * document.
michael@0 299 *
michael@0 300 * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture>
michael@0 301 */
michael@0 302 void releaseCapture();
michael@0 303
michael@0 304 /**
michael@0 305 * Use the given DOM element as the source image of target |-moz-element()|.
michael@0 306 *
michael@0 307 * This function introduces a new special ID (called "image element ID"),
michael@0 308 * which is only used by |-moz-element()|, and associates it with the given
michael@0 309 * DOM element. Image elements ID's have the higher precedence than general
michael@0 310 * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called,
michael@0 311 * |-moz-element(#<id>)| uses |<element>| as the source image even if there
michael@0 312 * is another element with id attribute = |<id>|. To unregister an image
michael@0 313 * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|.
michael@0 314 *
michael@0 315 * Example:
michael@0 316 * <script>
michael@0 317 * canvas = document.createElement("canvas");
michael@0 318 * canvas.setAttribute("width", 100);
michael@0 319 * canvas.setAttribute("height", 100);
michael@0 320 * // draw to canvas
michael@0 321 * document.mozSetImageElement("canvasbg", canvas);
michael@0 322 * </script>
michael@0 323 * <div style="background-image: -moz-element(#canvasbg);"></div>
michael@0 324 *
michael@0 325 * @param aImageElementId an image element ID to associate with
michael@0 326 * |aImageElement|
michael@0 327 * @param aImageElement a DOM element to be used as the source image of
michael@0 328 * |-moz-element(#aImageElementId)|. If this is null, the function will
michael@0 329 * unregister the image element ID |aImageElementId|.
michael@0 330 *
michael@0 331 * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement>
michael@0 332 */
michael@0 333 void mozSetImageElement(in DOMString aImageElementId,
michael@0 334 in nsIDOMElement aImageElement);
michael@0 335
michael@0 336 /**
michael@0 337 * Element which is currently the full-screen element as per the DOM
michael@0 338 * full-screen api.
michael@0 339 *
michael@0 340 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
michael@0 341 */
michael@0 342 readonly attribute nsIDOMElement mozFullScreenElement;
michael@0 343
michael@0 344 /**
michael@0 345 * Causes the document to leave DOM full-screen mode, if it's in
michael@0 346 * full-screen mode, as per the DOM full-screen api.
michael@0 347 *
michael@0 348 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
michael@0 349 */
michael@0 350 void mozCancelFullScreen();
michael@0 351
michael@0 352 /**
michael@0 353 * Denotes whether this document is in DOM full-screen mode, as per the DOM
michael@0 354 * full-screen api.
michael@0 355 *
michael@0 356 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
michael@0 357 */
michael@0 358 readonly attribute boolean mozFullScreen;
michael@0 359
michael@0 360 /**
michael@0 361 * Denotes whether the full-screen-api.enabled is true, no windowed
michael@0 362 * plugins are present, and all ancestor documents have the
michael@0 363 * allowfullscreen attribute set.
michael@0 364 *
michael@0 365 * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
michael@0 366 */
michael@0 367 readonly attribute boolean mozFullScreenEnabled;
michael@0 368
michael@0 369 /**
michael@0 370 * The element to which the mouse pointer is locked, if any, as per the
michael@0 371 * DOM pointer lock api.
michael@0 372 *
michael@0 373 * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
michael@0 374 */
michael@0 375 readonly attribute nsIDOMElement mozPointerLockElement;
michael@0 376
michael@0 377 /**
michael@0 378 * Retrieve the location of the caret position (DOM node and character
michael@0 379 * offset within that node), given a point.
michael@0 380 *
michael@0 381 * @param x Horizontal point at which to determine the caret position, in
michael@0 382 * page coordinates.
michael@0 383 * @param y Vertical point at which to determine the caret position, in
michael@0 384 * page coordinates.
michael@0 385 */
michael@0 386 nsISupports /* CaretPosition */ caretPositionFromPoint(in float x, in float y);
michael@0 387
michael@0 388 /**
michael@0 389 * Exit pointer is lock if locked, as per the DOM pointer lock api.
michael@0 390 *
michael@0 391 * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
michael@0 392 */
michael@0 393 void mozExitPointerLock();
michael@0 394
michael@0 395 /**
michael@0 396 * Visibility API implementation.
michael@0 397 */
michael@0 398 readonly attribute boolean hidden;
michael@0 399 readonly attribute boolean mozHidden;
michael@0 400 readonly attribute DOMString visibilityState;
michael@0 401 readonly attribute DOMString mozVisibilityState;
michael@0 402
michael@0 403 /**
michael@0 404 * Returns "BackCompat" if we're in quirks mode or "CSS1Compat" if we're in
michael@0 405 * strict mode. (XML documents are always in strict mode.)
michael@0 406 */
michael@0 407 readonly attribute DOMString compatMode;
michael@0 408
michael@0 409 /**
michael@0 410 * Return nodes that match a given CSS selector.
michael@0 411 *
michael@0 412 * @see <http://dev.w3.org/2006/webapi/selectors-api/>
michael@0 413 */
michael@0 414 nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors);
michael@0 415 nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors);
michael@0 416 };

mercurial