2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 callback CustomElementConstructor = Element ();
23 typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
26 SpecialWrapFor=(HTMLDocument,XMLDocument)
27 ] interface Document : Node {
30 readonly attribute DocumentType doctype;
31 readonly attribute DOMImplementation implementation;
32 readonly attribute Element documentElement;
34 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString tagName);
35 DocumentFragment createDocumentFragment();
36 Text createTextNode(DOMString data);
37 Comment createComment(DOMString data);
38 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
39 [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
40 [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
41 HTMLCollection getElementsByTagName(DOMString localName);
43 // Introduced in DOM Level 2:
45 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false);
46 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
47 [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI,
48 [Default=Undefined] optional DOMString? qualifiedName); // Removed from DOM4.
49 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
50 [PerWorldBindings] Element getElementById(DOMString elementId);
54 [MeasureAs=DocumentInputEncoding] readonly attribute DOMString? inputEncoding; // Removed from DOM4.
56 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; // Removed from DOM4.
57 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4.
58 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
60 [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node);
62 [ImplementedAs=url] readonly attribute DOMString? documentURI;
64 // DOM Level 2 Events (DocumentEvents interface)
66 [RaisesException] Event createEvent(DOMString eventType);
68 // DOM Level 2 Traversal and Range (DocumentRange interface)
72 // DOM Level 2 Traversal and Range (DocumentTraversal interface)
74 [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root,
75 optional unsigned long whatToShow = 0xFFFFFFFF,
76 optional NodeFilter? filter = null);
77 [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root,
78 optional unsigned long whatToShow = 0xFFFFFFFF,
79 optional NodeFilter? filter = null);
81 // DOM Level 2 Abstract Views (DocumentView interface)
83 [ImplementedAs=domWindow] readonly attribute Window defaultView;
85 // DOM Level 2 Style (DocumentStyle interface)
87 readonly attribute StyleSheetList styleSheets;
89 // DOM Level 2 Style (DocumentCSS interface)
91 CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
92 [Default=Undefined] optional DOMString pseudoElement);
95 readonly attribute DOMString contentType;
98 [CustomElementCallbacks]
99 boolean execCommand([Default=Undefined] optional DOMString command,
100 [Default=Undefined] optional boolean userInterface,
101 [TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? value);
103 boolean queryCommandEnabled([Default=Undefined] optional DOMString command);
104 boolean queryCommandIndeterm([Default=Undefined] optional DOMString command);
105 boolean queryCommandState([Default=Undefined] optional DOMString command);
106 boolean queryCommandSupported([Default=Undefined] optional DOMString command);
107 DOMString queryCommandValue([Default=Undefined] optional DOMString command);
109 // Moved down from HTMLDocument
110 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
111 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
112 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
113 readonly attribute DOMString referrer;
114 [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain;
115 readonly attribute DOMString URL;
117 [TreatNullAs=NullString, RaisesException] attribute DOMString cookie;
119 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface] attribute HTMLElement? body;
121 readonly attribute HTMLHeadElement head;
122 readonly attribute HTMLCollection images;
123 readonly attribute HTMLCollection applets;
124 readonly attribute HTMLCollection embeds;
125 [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
126 readonly attribute HTMLCollection links;
127 readonly attribute HTMLCollection forms;
128 readonly attribute HTMLCollection scripts;
129 readonly attribute HTMLCollection anchors;
130 readonly attribute DOMString lastModified;
132 [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
134 [PutForwards=href] readonly attribute Location location;
137 [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
138 [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
139 [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
141 Element elementFromPoint([Default=Undefined] optional long x,
142 [Default=Undefined] optional long y);
143 [MeasureAs=DocumentCaretRangeFromPoint]
144 Range caretRangeFromPoint([Default=Undefined] optional long x,
145 [Default=Undefined] optional long y);
147 // Mozilla extensions
148 Selection getSelection();
149 readonly attribute DOMString? characterSet;
153 readonly attribute DOMString? preferredStylesheetSet;
154 attribute DOMString? selectedStylesheetSet;
156 [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
159 HTMLCollection getElementsByClassName(DOMString classNames);
160 readonly attribute Element activeElement;
163 readonly attribute DOMString compatMode;
165 [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
166 [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
168 // Event handler attributes
169 attribute EventHandler onbeforecopy;
170 attribute EventHandler onbeforecut;
171 attribute EventHandler onbeforepaste;
172 attribute EventHandler oncopy;
173 attribute EventHandler oncut;
174 attribute EventHandler onpaste;
175 attribute EventHandler onpointerlockchange;
176 attribute EventHandler onpointerlockerror;
177 attribute EventHandler onreadystatechange;
178 attribute EventHandler onsearch;
179 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
180 attribute EventHandler onselectionchange;
181 attribute EventHandler onselectstart;
182 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
183 [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
184 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
185 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
186 attribute EventHandler onwheel;
188 [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
189 [Default=Undefined] optional EventTarget target,
190 [Default=Undefined] optional long identifier,
191 [Default=Undefined] optional double pageX,
192 [Default=Undefined] optional double pageY,
193 [Default=Undefined] optional double screenX,
194 [Default=Undefined] optional double screenY,
195 [Default=Undefined] optional double webkitRadiusX,
196 [Default=Undefined] optional double webkitRadiusY,
197 [Default=Undefined] optional float webkitRotationAngle,
198 [Default=Undefined] optional float webkitForce);
199 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
201 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional Dictionary options);
202 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension);
203 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension);
205 // Page visibility API.
206 readonly attribute DOMString visibilityState;
207 readonly attribute boolean hidden;
209 // Deprecated prefixed page visibility API.
210 // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting
211 // document in the console. It's possible http://crbug.com/43394 will resolve this.
212 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
213 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;
215 readonly attribute HTMLScriptElement currentScript;
218 Document implements GlobalEventHandlers;
219 Document implements ParentNode;