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