1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/interfaces/core/nsIDOMDocument.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,416 @@ 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 +%{ C++ 1.12 +#include "jspubtd.h" 1.13 + 1.14 +// windows.h #defines CreateEvent 1.15 +#ifdef CreateEvent 1.16 +#undef CreateEvent 1.17 +#endif 1.18 +%} 1.19 + 1.20 +interface nsIDOMNodeIterator; 1.21 +interface nsIDOMNodeFilter; 1.22 +interface nsIDOMTreeWalker; 1.23 +interface nsIDOMLocation; 1.24 + 1.25 +/** 1.26 + * The nsIDOMDocument interface represents the entire HTML or XML document. 1.27 + * Conceptually, it is the root of the document tree, and provides the 1.28 + * primary access to the document's data. 1.29 + * Since elements, text nodes, comments, processing instructions, etc. 1.30 + * cannot exist outside the context of a Document, the nsIDOMDocument 1.31 + * interface also contains the factory methods needed to create these 1.32 + * objects. 1.33 + * 1.34 + * For more information on this interface please see 1.35 + * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html 1.36 + */ 1.37 + 1.38 +[scriptable, uuid(d24d1118-a527-4d5a-9c4e-fb07dfc2fc27)] 1.39 +interface nsIDOMDocument : nsIDOMNode 1.40 +{ 1.41 + readonly attribute nsIDOMDocumentType doctype; 1.42 + readonly attribute nsIDOMDOMImplementation implementation; 1.43 + readonly attribute nsIDOMElement documentElement; 1.44 + nsIDOMElement createElement([Null(Stringify)] in DOMString tagName) 1.45 + raises(DOMException); 1.46 + nsIDOMDocumentFragment createDocumentFragment(); 1.47 + nsIDOMText createTextNode(in DOMString data); 1.48 + nsIDOMComment createComment(in DOMString data); 1.49 + nsIDOMCDATASection createCDATASection(in DOMString data) 1.50 + raises(DOMException); 1.51 + nsIDOMProcessingInstruction createProcessingInstruction(in DOMString target, 1.52 + in DOMString data) 1.53 + raises(DOMException); 1.54 + nsIDOMAttr createAttribute(in DOMString name) 1.55 + raises(DOMException); 1.56 + nsIDOMNodeList getElementsByTagName(in DOMString tagname); 1.57 + 1.58 + // Introduced in DOM Level 2: 1.59 + [optional_argc] nsIDOMNode importNode(in nsIDOMNode importedNode, 1.60 + [optional] in boolean deep) 1.61 + raises(DOMException); 1.62 + // Introduced in DOM Level 2: 1.63 + nsIDOMElement createElementNS(in DOMString namespaceURI, 1.64 + [Null(Stringify)] in DOMString qualifiedName) 1.65 + raises(DOMException); 1.66 + // Introduced in DOM Level 2: 1.67 + nsIDOMAttr createAttributeNS(in DOMString namespaceURI, 1.68 + in DOMString qualifiedName) 1.69 + raises(DOMException); 1.70 + // Introduced in DOM Level 2: 1.71 + nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI, 1.72 + in DOMString localName); 1.73 + // Introduced in DOM Level 2: 1.74 + nsIDOMElement getElementById(in DOMString elementId); 1.75 + // Introduced in DOM Level 3: 1.76 + readonly attribute DOMString inputEncoding; 1.77 + // Introduced in DOM Level 3: 1.78 + readonly attribute DOMString documentURI; 1.79 + // Alias introduced for all documents in recent DOM standards 1.80 + readonly attribute DOMString URL; 1.81 + // Introduced in DOM Level 3: 1.82 + nsIDOMNode adoptNode(in nsIDOMNode source) 1.83 + raises(DOMException); 1.84 + 1.85 + /** 1.86 + * Create a range 1.87 + * 1.88 + * @see http://html5.org/specs/dom-range.html#dom-document-createrange 1.89 + */ 1.90 + nsIDOMRange createRange(); 1.91 + 1.92 + [optional_argc] nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, 1.93 + [optional] in unsigned long whatToShow, 1.94 + [optional] in nsIDOMNodeFilter filter) 1.95 + raises(DOMException); 1.96 + [optional_argc] nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, 1.97 + [optional] in unsigned long whatToShow, 1.98 + [optional] in nsIDOMNodeFilter filter) 1.99 + raises(DOMException); 1.100 + 1.101 + nsIDOMEvent createEvent(in DOMString eventType) 1.102 + raises(DOMException); 1.103 + 1.104 + 1.105 + // HTML 1.106 + /** 1.107 + * The window associated with this document. 1.108 + * 1.109 + * @see <http://www.whatwg.org/html/#dom-document-defaultview> 1.110 + */ 1.111 + readonly attribute nsIDOMWindow defaultView; 1.112 + 1.113 + /** 1.114 + * @see <http://www.whatwg.org/html/#dom-document-characterset> 1.115 + */ 1.116 + readonly attribute DOMString characterSet; 1.117 + /** 1.118 + * @see <http://www.whatwg.org/html/#dom-document-dir> 1.119 + */ 1.120 + attribute DOMString dir; 1.121 + 1.122 + /** 1.123 + * @see <http://www.whatwg.org/html/#dom-document-location> 1.124 + */ 1.125 + readonly attribute nsIDOMLocation location; 1.126 + 1.127 + /** 1.128 + * @see <http://www.whatwg.org/html/#document.title> 1.129 + */ 1.130 + attribute DOMString title; 1.131 + 1.132 + /** 1.133 + * @see <http://www.whatwg.org/html/#dom-document-readystate> 1.134 + */ 1.135 + readonly attribute DOMString readyState; 1.136 + /** 1.137 + * @see <http://www.whatwg.org/html/#dom-document-lastmodified> 1.138 + */ 1.139 + readonly attribute DOMString lastModified; 1.140 + /** 1.141 + * @see <http://www.whatwg.org/html/#dom-document-referrer> 1.142 + */ 1.143 + readonly attribute DOMString referrer; 1.144 + 1.145 + /** 1.146 + * @see <http://www.whatwg.org/html/#dom-document-hasfocus> 1.147 + */ 1.148 + boolean hasFocus(); 1.149 + 1.150 + /** 1.151 + * @see <http://www.whatwg.org/html/#dom-document-activeelement> 1.152 + */ 1.153 + readonly attribute nsIDOMElement activeElement; 1.154 + 1.155 + /** 1.156 + * Retrieve elements matching all classes listed in a 1.157 + * space-separated string. 1.158 + * 1.159 + * @see <http://www.whatwg.org/html/#dom-document-getelementsbyclassname> 1.160 + */ 1.161 + nsIDOMNodeList getElementsByClassName(in DOMString classes); 1.162 + 1.163 + 1.164 + // CSSOM 1.165 + /** 1.166 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-stylesheets> 1.167 + */ 1.168 + readonly attribute nsIDOMStyleSheetList styleSheets; 1.169 + 1.170 + /** 1.171 + * This attribute must return the preferred style sheet set as set by the 1.172 + * author. It is determined from the order of style sheet declarations and 1.173 + * the Default-Style HTTP headers, as eventually defined elsewhere in the Web 1.174 + * Apps 1.0 specification. If there is no preferred style sheet set, this 1.175 + * attribute must return the empty string. The case of this attribute must 1.176 + * exactly match the case given by the author where the preferred style sheet 1.177 + * is specified or implied. This attribute must never return null. 1.178 + * 1.179 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-preferredStyleSheetSet> 1.180 + */ 1.181 + readonly attribute DOMString preferredStyleSheetSet; 1.182 + 1.183 + /** 1.184 + * This attribute indicates which style sheet set is in use. This attribute 1.185 + * is live; changing the disabled attribute on style sheets directly will 1.186 + * change the value of this attribute. 1.187 + * 1.188 + * If all the sheets that are enabled and have a title have the same title 1.189 + * (by case-sensitive comparisons) then the value of this attribute must be 1.190 + * exactly equal to the title of the first enabled style sheet with a title 1.191 + * in the styleSheets list. Otherwise, if style sheets from different sets 1.192 + * are enabled, then the return value must be null (there is no way to 1.193 + * determine what the currently selected style sheet set is in those 1.194 + * conditions). Otherwise, either all style sheets that have a title are 1.195 + * disabled, or there are no alternate style sheets, and 1.196 + * selectedStyleSheetSet must return the empty string. 1.197 + * 1.198 + * Setting this attribute to the null value must have no effect. 1.199 + * 1.200 + * Setting this attribute to a non-null value must call 1.201 + * enableStyleSheetsForSet() with that value as the function's argument, and 1.202 + * set lastStyleSheetSet to that value. 1.203 + * 1.204 + * From the DOM's perspective, all views have the same 1.205 + * selectedStyleSheetSet. If a UA supports multiple views with different 1.206 + * selected alternate style sheets, then this attribute (and the StyleSheet 1.207 + * interface's disabled attribute) must return and set the value for the 1.208 + * default view. 1.209 + * 1.210 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-selectedStyleSheetSet> 1.211 + */ 1.212 + [binaryname(MozSelectedStyleSheetSet)] 1.213 + attribute DOMString selectedStyleSheetSet; 1.214 + 1.215 + /* 1.216 + * This property must initially have the value null. Its value changes when 1.217 + * the selectedStyleSheetSet attribute is set. 1.218 + * 1.219 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-lastStyleSheetSet> 1.220 + */ 1.221 + readonly attribute DOMString lastStyleSheetSet; 1.222 + 1.223 + /** 1.224 + * This must return the live list of the currently available style sheet 1.225 + * sets. This list is constructed by enumerating all the style sheets for 1.226 + * this document available to the implementation, in the order they are 1.227 + * listed in the styleSheets attribute, adding the title of each style sheet 1.228 + * with a title to the list, avoiding duplicates by dropping titles that 1.229 + * match (case-sensitively) titles that have already been added to the 1.230 + * list. 1.231 + * 1.232 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-styleSheetSets> 1.233 + */ 1.234 + readonly attribute nsISupports styleSheetSets; 1.235 + 1.236 + /** 1.237 + * Calling this method must change the disabled attribute on each StyleSheet 1.238 + * object with a title attribute with a length greater than 0 in the 1.239 + * styleSheets attribute, so that all those whose title matches the name 1.240 + * argument are enabled, and all others are disabled. Title matches must be 1.241 + * case-sensitive. Calling this method with the empty string disables all 1.242 + * alternate and preferred style sheets (but does not change the state of 1.243 + * persistent style sheets, that is those with no title attribute). 1.244 + * 1.245 + * Calling this method with a null value must have no effect. 1.246 + * 1.247 + * Style sheets that do not have a title are never affected by this 1.248 + * method. This method does not change the values of the lastStyleSheetSet or 1.249 + * preferredStyleSheetSet attributes. 1.250 + * 1.251 + * @see <http://dev.w3.org/csswg/cssom/#dom-document-enableStyleSheetsForSet> 1.252 + */ 1.253 + [binaryname(MozEnableStyleSheetsForSet)] 1.254 + void enableStyleSheetsForSet(in DOMString name); 1.255 + 1.256 + 1.257 + // CSSOM-View 1.258 + /** 1.259 + * Returns the element from the caller's document at the given point, 1.260 + * relative to the upper-left-most point in the (possibly scrolled) 1.261 + * window or frame. 1.262 + * 1.263 + * If the element at the given point belongs to another document (such as 1.264 + * an iframe's subdocument), the element in the calling document's DOM 1.265 + * (e.g. the iframe) is returned. If the element at the given point is 1.266 + * anonymous or XBL generated content, such as a textbox's scrollbars, then 1.267 + * the first non-anonymous parent element (that is, the textbox) is returned. 1.268 + * 1.269 + * This method returns null if either coordinate is negative, or if the 1.270 + * specified point lies outside the visible bounds of the document. 1.271 + * 1.272 + * Callers from XUL documents should wait until the onload event has fired 1.273 + * before calling this method. 1.274 + * 1.275 + * @see <http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint> 1.276 + */ 1.277 + nsIDOMElement elementFromPoint(in float x, in float y); 1.278 + 1.279 + 1.280 + // Mozilla extensions 1.281 + /** 1.282 + * @see <https://developer.mozilla.org/en/DOM/document.contentType> 1.283 + */ 1.284 + readonly attribute DOMString contentType; 1.285 + 1.286 + /** 1.287 + * True if this document is synthetic : stand alone image, video, audio file, 1.288 + * etc. 1.289 + */ 1.290 + readonly attribute boolean mozSyntheticDocument; 1.291 + 1.292 + /** 1.293 + * Returns the script element whose script is currently being processed. 1.294 + * 1.295 + * @see <https://developer.mozilla.org/en/DOM/document.currentScript> 1.296 + */ 1.297 + readonly attribute nsIDOMElement currentScript; 1.298 + 1.299 + /** 1.300 + * Release the current mouse capture if it is on an element within this 1.301 + * document. 1.302 + * 1.303 + * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture> 1.304 + */ 1.305 + void releaseCapture(); 1.306 + 1.307 + /** 1.308 + * Use the given DOM element as the source image of target |-moz-element()|. 1.309 + * 1.310 + * This function introduces a new special ID (called "image element ID"), 1.311 + * which is only used by |-moz-element()|, and associates it with the given 1.312 + * DOM element. Image elements ID's have the higher precedence than general 1.313 + * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called, 1.314 + * |-moz-element(#<id>)| uses |<element>| as the source image even if there 1.315 + * is another element with id attribute = |<id>|. To unregister an image 1.316 + * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|. 1.317 + * 1.318 + * Example: 1.319 + * <script> 1.320 + * canvas = document.createElement("canvas"); 1.321 + * canvas.setAttribute("width", 100); 1.322 + * canvas.setAttribute("height", 100); 1.323 + * // draw to canvas 1.324 + * document.mozSetImageElement("canvasbg", canvas); 1.325 + * </script> 1.326 + * <div style="background-image: -moz-element(#canvasbg);"></div> 1.327 + * 1.328 + * @param aImageElementId an image element ID to associate with 1.329 + * |aImageElement| 1.330 + * @param aImageElement a DOM element to be used as the source image of 1.331 + * |-moz-element(#aImageElementId)|. If this is null, the function will 1.332 + * unregister the image element ID |aImageElementId|. 1.333 + * 1.334 + * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement> 1.335 + */ 1.336 + void mozSetImageElement(in DOMString aImageElementId, 1.337 + in nsIDOMElement aImageElement); 1.338 + 1.339 + /** 1.340 + * Element which is currently the full-screen element as per the DOM 1.341 + * full-screen api. 1.342 + * 1.343 + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> 1.344 + */ 1.345 + readonly attribute nsIDOMElement mozFullScreenElement; 1.346 + 1.347 + /** 1.348 + * Causes the document to leave DOM full-screen mode, if it's in 1.349 + * full-screen mode, as per the DOM full-screen api. 1.350 + * 1.351 + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> 1.352 + */ 1.353 + void mozCancelFullScreen(); 1.354 + 1.355 + /** 1.356 + * Denotes whether this document is in DOM full-screen mode, as per the DOM 1.357 + * full-screen api. 1.358 + * 1.359 + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> 1.360 + */ 1.361 + readonly attribute boolean mozFullScreen; 1.362 + 1.363 + /** 1.364 + * Denotes whether the full-screen-api.enabled is true, no windowed 1.365 + * plugins are present, and all ancestor documents have the 1.366 + * allowfullscreen attribute set. 1.367 + * 1.368 + * @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI> 1.369 + */ 1.370 + readonly attribute boolean mozFullScreenEnabled; 1.371 + 1.372 + /** 1.373 + * The element to which the mouse pointer is locked, if any, as per the 1.374 + * DOM pointer lock api. 1.375 + * 1.376 + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> 1.377 + */ 1.378 + readonly attribute nsIDOMElement mozPointerLockElement; 1.379 + 1.380 + /** 1.381 + * Retrieve the location of the caret position (DOM node and character 1.382 + * offset within that node), given a point. 1.383 + * 1.384 + * @param x Horizontal point at which to determine the caret position, in 1.385 + * page coordinates. 1.386 + * @param y Vertical point at which to determine the caret position, in 1.387 + * page coordinates. 1.388 + */ 1.389 + nsISupports /* CaretPosition */ caretPositionFromPoint(in float x, in float y); 1.390 + 1.391 + /** 1.392 + * Exit pointer is lock if locked, as per the DOM pointer lock api. 1.393 + * 1.394 + * @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html> 1.395 + */ 1.396 + void mozExitPointerLock(); 1.397 + 1.398 + /** 1.399 + * Visibility API implementation. 1.400 + */ 1.401 + readonly attribute boolean hidden; 1.402 + readonly attribute boolean mozHidden; 1.403 + readonly attribute DOMString visibilityState; 1.404 + readonly attribute DOMString mozVisibilityState; 1.405 + 1.406 + /** 1.407 + * Returns "BackCompat" if we're in quirks mode or "CSS1Compat" if we're in 1.408 + * strict mode. (XML documents are always in strict mode.) 1.409 + */ 1.410 + readonly attribute DOMString compatMode; 1.411 + 1.412 + /** 1.413 + * Return nodes that match a given CSS selector. 1.414 + * 1.415 + * @see <http://dev.w3.org/2006/webapi/selectors-api/> 1.416 + */ 1.417 + nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors); 1.418 + nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors); 1.419 +};