summaryrefslogtreecommitdiff
path: root/Source/core/dom/Document.idl
blob: c0b3801f4d3edb114531b4e591d94883ccfb15c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*
 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

callback CustomElementConstructor = Element ();

typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;

[
    SpecialWrapFor=HTMLDocument|XMLDocument
] interface Document : Node {

    // DOM Level 1 Core
    readonly attribute DocumentType doctype;
    readonly attribute DOMImplementation implementation;
    readonly attribute Element documentElement;

    [CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Element createElement(DOMString tagName);
    DocumentFragment createDocumentFragment();
    Text createTextNode(DOMString data);
    Comment createComment(DOMString data);
    [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
    [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
    [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
    HTMLCollection getElementsByTagName(DOMString localName);

    // Introduced in DOM Level 2:

    [CustomElementCallbacks, LogActivity, RaisesException] Node importNode(Node node, optional boolean deep);
    [CustomElementCallbacks, LogActivity, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName);
    [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
                                                                                  [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4.
    HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
    [PerWorldBindings] Element getElementById(DOMString elementId);

    // DOM Level 3 Core

    [TreatReturnedNullStringAs=Null, MeasureAs=DocumentInputEncoding] readonly attribute DOMString inputEncoding; // Removed from DOM4.

    [TreatReturnedNullStringAs=Null, MeasureAs=DocumentXMLEncoding] readonly attribute DOMString xmlEncoding; // Removed from DOM4.
    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4.
    [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.

    [RaisesException, CustomElementCallbacks] Node adoptNode(Node node);

    [TreatReturnedNullStringAs=Null, ImplementedAs=url] readonly attribute DOMString documentURI;

    // DOM Level 2 Events (DocumentEvents interface)

    [RaisesException] Event createEvent(DOMString eventType);

    // DOM Level 2 Traversal and Range (DocumentRange interface)

    Range createRange();

    // DOM Level 2 Traversal and Range (DocumentTraversal interface)

    [RaisesException] NodeIterator createNodeIterator(Node root,
                                                      optional unsigned long whatToShow,
                                                      optional NodeFilter filter);
    [RaisesException] TreeWalker createTreeWalker(Node root,
                                                  optional unsigned long whatToShow,
                                                  optional NodeFilter filter);

    // DOM Level 2 Abstract Views (DocumentView interface)

    [ImplementedAs=executingWindow] readonly attribute Window defaultView;

    // DOM Level 2 Style (DocumentStyle interface)

    readonly attribute StyleSheetList styleSheets;

    // DOM Level 2 Style (DocumentCSS interface)

     CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
                                                        [Default=Undefined] optional DOMString pseudoElement);

    // DOM 4
    readonly attribute DOMString contentType;

    // Common extensions
    [CustomElementCallbacks]
    boolean            execCommand([Default=Undefined] optional DOMString command,
                                   [Default=Undefined] optional boolean userInterface,
                                   [TreatNullAs=NullString, TreatUndefinedAs=NullString,Default=Undefined] optional DOMString value);

    boolean            queryCommandEnabled([Default=Undefined] optional DOMString command);
    boolean            queryCommandIndeterm([Default=Undefined] optional DOMString command);
    boolean            queryCommandState([Default=Undefined] optional DOMString command);
    boolean            queryCommandSupported([Default=Undefined] optional DOMString command);
    DOMString          queryCommandValue([Default=Undefined] optional DOMString command);

    // Moved down from HTMLDocument
             [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
             [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
             [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
    readonly attribute DOMString referrer;
             [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain;
    readonly attribute DOMString URL;

             [TreatNullAs=NullString, RaisesException] attribute DOMString cookie;

             [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings] attribute HTMLElement body;

    readonly attribute HTMLHeadElement head;
    readonly attribute HTMLCollection images;
    readonly attribute HTMLCollection applets;
    readonly attribute HTMLCollection embeds;
    [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
    readonly attribute HTMLCollection links;
    readonly attribute HTMLCollection forms;
    readonly attribute HTMLCollection scripts;
    readonly attribute HTMLCollection anchors;
    readonly attribute DOMString lastModified;

    [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);

    [LogActivity, PutForwards=href] readonly attribute Location location;

    // IE extensions
    [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
    [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
    [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;

    Element            elementFromPoint([Default=Undefined] optional long x,
                                        [Default=Undefined] optional long y);
    [MeasureAs=DocumentCaretRangeFromPoint]
    Range              caretRangeFromPoint([Default=Undefined] optional long x,
                                           [Default=Undefined] optional long y);

    // Mozilla extensions
    Selection          getSelection();
    [TreatReturnedNullStringAs=Null] readonly attribute DOMString characterSet;

    // WebKit extensions

    [TreatReturnedNullStringAs=Null] readonly attribute DOMString preferredStylesheetSet;
    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString selectedStylesheetSet;

    [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);

    // HTML 5
    HTMLCollection getElementsByClassName(DOMString classNames);
    readonly attribute Element activeElement;
    boolean hasFocus();

    readonly attribute DOMString compatMode;

    [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
    [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
    [MeasureAs=PrefixedDocumentExitPointerLock, ImplementedAs=exitPointerLock] void webkitExitPointerLock();
    [MeasureAs=PrefixedDocumentPointerLockElement, ImplementedAs=pointerLockElement] readonly attribute Element webkitPointerLockElement;

    // Event handler attributes
    attribute EventHandler onbeforecopy;
    attribute EventHandler onbeforecut;
    attribute EventHandler onbeforepaste;
    attribute EventHandler oncopy;
    attribute EventHandler oncut;
    attribute EventHandler onpaste;
    attribute EventHandler onpointerlockchange;
    attribute EventHandler onpointerlockerror;
    attribute EventHandler onreadystatechange;
    attribute EventHandler onsearch;
    [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
    attribute EventHandler onselectionchange;
    attribute EventHandler onselectstart;
    [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
    [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
    [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
    [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
    attribute EventHandler onwebkitfullscreenchange;
    attribute EventHandler onwebkitfullscreenerror;
    attribute EventHandler onwebkitpointerlockchange;
    attribute EventHandler onwebkitpointerlockerror;
    [LogActivity=SetterOnly] attribute EventHandler onwheel;

    [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
                                               [Default=Undefined] optional EventTarget target,
                                               [Default=Undefined] optional long identifier,
                                               [Default=Undefined] optional double pageX,
                                               [Default=Undefined] optional double pageY,
                                               [Default=Undefined] optional double screenX,
                                               [Default=Undefined] optional double screenY,
                                               [Default=Undefined] optional double webkitRadiusX,
                                               [Default=Undefined] optional double webkitRadiusY,
                                               [Default=Undefined] optional float webkitRotationAngle,
                                               [Default=Undefined] optional float webkitForce);
    [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);

    [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional Dictionary options);
    [CustomElementCallbacks, PerWorldBindings, LogActivity, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
    [CustomElementCallbacks, LogActivity, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName,
                            [TreatNullAs=NullString] DOMString typeExtension);

    // Page visibility API.
    readonly attribute DOMString visibilityState;
    readonly attribute boolean hidden;

    // Deprecated prefixed page visibility API.
    // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting
    // document in the console. It's possible http://crbug.com/43394 will resolve this.
    [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
    [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;

    readonly attribute HTMLScriptElement currentScript;
};

Document implements GlobalEventHandlers;
Document implements ParentNode;