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;
25 interface Document : Node {
28 readonly attribute DocumentType doctype;
29 readonly attribute DOMImplementation implementation;
30 readonly attribute Element documentElement;
32 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString tagName);
33 DocumentFragment createDocumentFragment();
34 Text createTextNode(DOMString data);
35 Comment createComment(DOMString data);
36 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
37 [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
38 [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
39 HTMLCollection getElementsByTagName(DOMString localName);
41 // Introduced in DOM Level 2:
43 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false);
44 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
45 [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI,
46 [Default=Undefined] optional DOMString? qualifiedName); // Removed from DOM4.
47 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
48 [PerWorldBindings] Element getElementById(DOMString elementId);
52 [MeasureAs=DocumentInputEncoding] readonly attribute DOMString? inputEncoding; // Removed from DOM4.
54 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; // Removed from DOM4.
55 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4.
56 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
58 [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node);
60 [ImplementedAs=url] readonly attribute DOMString? documentURI;
62 // DOM Level 2 Events (DocumentEvents interface)
64 [RaisesException] Event createEvent(DOMString eventType);
66 // DOM Level 2 Traversal and Range (DocumentRange interface)
70 // DOM Level 2 Traversal and Range (DocumentTraversal interface)
72 [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root,
73 optional unsigned long whatToShow = 0xFFFFFFFF,
74 optional NodeFilter? filter = null);
75 [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root,
76 optional unsigned long whatToShow = 0xFFFFFFFF,
77 optional NodeFilter? filter = null);
79 // DOM Level 2 Abstract Views (DocumentView interface)
81 [ImplementedAs=domWindow] readonly attribute Window defaultView;
83 // DOM Level 2 Style (DocumentStyle interface)
85 readonly attribute StyleSheetList styleSheets;
87 // DOM Level 2 Style (DocumentCSS interface)
89 CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
90 [Default=Undefined] optional DOMString pseudoElement);
93 readonly attribute DOMString contentType;
96 [CustomElementCallbacks]
97 boolean execCommand([Default=Undefined] optional DOMString command,
98 [Default=Undefined] optional boolean userInterface,
99 [TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? value);
101 boolean queryCommandEnabled([Default=Undefined] optional DOMString command);
102 boolean queryCommandIndeterm([Default=Undefined] optional DOMString command);
103 boolean queryCommandState([Default=Undefined] optional DOMString command);
104 boolean queryCommandSupported([Default=Undefined] optional DOMString command);
105 DOMString queryCommandValue([Default=Undefined] optional DOMString command);
107 // Moved down from HTMLDocument
108 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
109 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
110 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
111 readonly attribute DOMString referrer;
112 [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain;
113 readonly attribute DOMString URL;
115 [TreatNullAs=NullString, RaisesException] attribute DOMString cookie;
117 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface] attribute HTMLElement? body;
119 readonly attribute HTMLHeadElement head;
120 readonly attribute HTMLCollection images;
121 readonly attribute HTMLCollection applets;
122 readonly attribute HTMLCollection embeds;
123 [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
124 readonly attribute HTMLCollection links;
125 readonly attribute HTMLCollection forms;
126 readonly attribute HTMLCollection scripts;
127 readonly attribute HTMLCollection anchors;
128 readonly attribute DOMString lastModified;
130 [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
132 [PutForwards=href] readonly attribute Location location;
135 [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
136 [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
137 [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
139 Element elementFromPoint([Default=Undefined] optional long x,
140 [Default=Undefined] optional long y);
141 [MeasureAs=DocumentCaretRangeFromPoint]
142 Range caretRangeFromPoint([Default=Undefined] optional long x,
143 [Default=Undefined] optional long y);
145 // Mozilla extensions
146 Selection getSelection();
147 readonly attribute DOMString? characterSet;
151 readonly attribute DOMString? preferredStylesheetSet;
152 attribute DOMString? selectedStylesheetSet;
154 [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
157 HTMLCollection getElementsByClassName(DOMString classNames);
158 readonly attribute Element activeElement;
161 readonly attribute DOMString compatMode;
163 [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
164 [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
166 // Event handler attributes
167 attribute EventHandler onbeforecopy;
168 attribute EventHandler onbeforecut;
169 attribute EventHandler onbeforepaste;
170 attribute EventHandler oncopy;
171 attribute EventHandler oncut;
172 attribute EventHandler onpaste;
173 attribute EventHandler onpointerlockchange;
174 attribute EventHandler onpointerlockerror;
175 attribute EventHandler onreadystatechange;
176 attribute EventHandler onsearch;
177 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
178 attribute EventHandler onselectionchange;
179 attribute EventHandler onselectstart;
180 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
181 [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
182 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
183 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
184 attribute EventHandler onwheel;
186 [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
187 [Default=Undefined] optional EventTarget target,
188 [Default=Undefined] optional long identifier,
189 [Default=Undefined] optional double pageX,
190 [Default=Undefined] optional double pageY,
191 [Default=Undefined] optional double screenX,
192 [Default=Undefined] optional double screenY,
193 [Default=Undefined] optional double webkitRadiusX,
194 [Default=Undefined] optional double webkitRadiusY,
195 [Default=Undefined] optional float webkitRotationAngle,
196 [Default=Undefined] optional float webkitForce);
197 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
199 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional ElementRegistrationOptions options);
200 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension);
201 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension);
203 // Page visibility API.
204 readonly attribute DOMString visibilityState;
205 readonly attribute boolean hidden;
207 // Deprecated prefixed page visibility API.
208 // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting
209 // document in the console. It's possible http://crbug.com/43394 will resolve this.
210 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
211 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;
213 readonly attribute HTMLScriptElement currentScript;
216 Document implements GlobalEventHandlers;
217 Document implements ParentNode;