File: Document.idl

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (218 lines) | stat: -rw-r--r-- 12,031 bytes parent folder | download
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
/*
 * 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.
 */

[Custom] callback CustomElementConstructor = Element ();

// https://html.spec.whatwg.org/#the-document-object
enum DocumentReadyState { "loading", "interactive", "complete" };


// https://w3c.github.io/page-visibility/#visibility-states-and-the-visibilitystate-enum
enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };

// https://wicg.github.io/cors-rfc1918/#feature-detect
enum AddressSpace { "local", "private", "public" };

typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;

// https://dom.spec.whatwg.org/#interface-document

// FIXME: Document should have a constructor. crbug.com/238234
interface Document : Node {
    [SameObject] readonly attribute DOMImplementation implementation;
    readonly attribute DOMString URL;
    // FIXME: documentURI should not be nullable.
    [ImplementedAs=url] readonly attribute DOMString? documentURI;
    readonly attribute DOMString origin;
    [RuntimeEnabled=suborigins] readonly attribute DOMString suborigin;
    readonly attribute DOMString compatMode;

    readonly attribute DOMString characterSet;
    [ImplementedAs=characterSet] readonly attribute DOMString charset; // legacy alias of .characterSet
    [ImplementedAs=characterSet] readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
    readonly attribute DOMString contentType;

    readonly attribute DocumentType? doctype;
    readonly attribute Element? documentElement;
    HTMLCollection getElementsByTagName(DOMString localName);
    HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
    HTMLCollection getElementsByClassName(DOMString classNames);

    [NewObject, DoNotTestNewObject, CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName);
    [NewObject, DoNotTestNewObject, CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
    [NewObject] DocumentFragment createDocumentFragment();
    [NewObject] Text createTextNode(DOMString data);
    [NewObject, RaisesException] CDATASection createCDATASection(DOMString data);
    [NewObject] Comment createComment(DOMString data);
    [NewObject, RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);

    [NewObject, DoNotTestNewObject, CEReactions, CustomElementCallbacks, RaisesException] Node importNode(Node node, optional boolean deep = false);
    [RaisesException, CEReactions, CustomElementCallbacks] Node adoptNode(Node node);

    [NewObject, RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DOMString localName);
    [NewObject, RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS(DOMString? namespaceURI, DOMString qualifiedName);

    [NewObject, RaisesException, CallWith=ExecutionContext] Event createEvent(DOMString eventType);

    [NewObject] Range createRange();

    // NodeFilter.SHOW_ALL = 0xFFFFFFFF
    [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
    [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);

    // NonDocumentRootScroller (https://github.com/bokand/NonDocumentRootScroller)
    [RaisesException=Setter, RuntimeEnabled=SetRootScroller, Measure] attribute Element? rootScroller;

    // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the spec.
    [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding;
    [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion;
    [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone;

    // HTML
    // https://html.spec.whatwg.org/#the-document-object

    // resource metadata management

    [PutForwards=href, Unforgeable] readonly attribute Location? location;
    [RaisesException=Setter] attribute DOMString domain;
    readonly attribute DOMString referrer;
    [RaisesException] attribute DOMString cookie;
    readonly attribute DOMString lastModified;
    readonly attribute DocumentReadyState readyState;

    // DOM tree accessors
    [CEReactions, CustomElementCallbacks] attribute DOMString title;
    [CEReactions, CustomElementCallbacks] attribute DOMString dir;
    [CEReactions, RaisesException=Setter, CustomElementCallbacks, PerWorldBindings] attribute HTMLElement? body;
    readonly attribute HTMLHeadElement? head;
    [SameObject, Measure] readonly attribute HTMLCollection images;
    [SameObject, Measure] readonly attribute HTMLCollection embeds;
    [SameObject, ImplementedAs=embeds, Measure] readonly attribute HTMLCollection plugins;
    [SameObject, Measure] readonly attribute HTMLCollection links;
    [SameObject, Measure] readonly attribute HTMLCollection forms;
    [SameObject, Measure] readonly attribute HTMLCollection scripts;
    [PerWorldBindings] NodeList getElementsByName(DOMString elementName);
    [ImplementedAs=currentScriptForBinding] readonly attribute HTMLOrSVGScriptElement? currentScript;

    // dynamic markup insertion
    // FIXME: There are two open() methods in the spec.
    [Custom, CEReactions, CustomElementCallbacks, RaisesException, MeasureAs=DocumentOpen] void open();
    [CEReactions, RaisesException] void close();
    [CallWith=EnteredWindow, CEReactions, CustomElementCallbacks, RaisesException] void write(DOMString... text);
    [CallWith=EnteredWindow, CEReactions, CustomElementCallbacks, RaisesException] void writeln(DOMString... text);

    // user interaction
    [ImplementedAs=domWindow] readonly attribute Window? defaultView;
    boolean hasFocus();
    [CEReactions, CustomElementCallbacks, MeasureAs=DocumentDesignMode] attribute DOMString designMode;
    [CEReactions, CustomElementCallbacks, RaisesException] boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
    [RaisesException] boolean queryCommandEnabled(DOMString commandId);
    [RaisesException] boolean queryCommandIndeterm(DOMString commandId);
    [RaisesException] boolean queryCommandState(DOMString commandId);
    [RaisesException] boolean queryCommandSupported(DOMString commandId);
    [RaisesException] DOMString queryCommandValue(DOMString commandId);

    [LenientThis] attribute EventHandler onreadystatechange;

    // HTML obsolete features
    // https://html.spec.whatwg.org/#Document-partial

    // FIXME: *Color are on HTMLDocument.

    [Measure] readonly attribute HTMLCollection anchors;
    [Measure] readonly attribute HTMLCollection applets;

    // FIXME: clear(), captureEvents(), releaseEvents() and all are on HTMLDocument.

    // CSS Object Model (CSSOM)
    // https://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
    attribute DOMString? selectedStylesheetSet;
    readonly attribute DOMString? preferredStylesheetSet;

    readonly attribute Element? scrollingElement;

    // Pointer Lock
    // https://w3c.github.io/pointerlock/#extensions-to-the-document-interface
    attribute EventHandler onpointerlockchange;
    attribute EventHandler onpointerlockerror;
    [MeasureAs=DocumentExitPointerLock] void exitPointerLock();

    // Touch Events
    // https://w3c.github.io/touch-events/#extensions-to-the-document-interface
    // FIXME: The arguments should not be optional.
    [RuntimeEnabled=TouchEventFeatureDetection, Measure, LegacyInterfaceTypeChecking, Custom=CallPrologue]
    Touch createTouch([Default=Undefined] optional Window window,
                      [Default=Undefined] optional EventTarget target,
                      [Default=Undefined] optional long identifier,
                      [Default=Undefined] optional unrestricted double pageX,
                      [Default=Undefined] optional unrestricted double pageY,
                      [Default=Undefined] optional unrestricted double screenX,
                      [Default=Undefined] optional unrestricted double screenY,
                      [Default=Undefined] optional unrestricted double radiusX,
                      [Default=Undefined] optional unrestricted double radiusY,
                      [Default=Undefined] optional unrestricted float rotationAngle,
                      [Default=Undefined] optional unrestricted float force);
    [RuntimeEnabled=TouchEventFeatureDetection] TouchList createTouchList(Touch... touches);

    // Custom Elements
    // https://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-register
    // FIXME: The registerElement return type should be Function.
    [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString type, optional ElementRegistrationOptions options);
    // https://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-instantiate
    // FIXME: The typeExtension arguments should not be nullable.
    [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, (DOMString or Dictionary)? options);
    [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, (DOMString or Dictionary)? options);

    // Page Visibility
    // https://www.w3.org/TR/page-visibility/#sec-document-interface
    readonly attribute boolean hidden;
    readonly attribute VisibilityState visibilityState;

    // CORS and RFC1918
    // https://wicg.github.io/cors-rfc1918/#feature-detect
    [RuntimeEnabled=CorsRFC1918, ImplementedAs=addressSpaceForBindings] readonly attribute AddressSpace addressSpace;

    // Non-standard APIs
    [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=Undefined] optional long x, [Default=Undefined] optional long y);

    // 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 https://crbug.com/43394 will resolve this.
    [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
    [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;

    // Event handler attributes
    attribute EventHandler onbeforecopy;
    attribute EventHandler onbeforecut;
    attribute EventHandler onbeforepaste;
    attribute EventHandler oncopy;
    attribute EventHandler oncut;
    attribute EventHandler onpaste;
    attribute EventHandler onsearch;
    [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
    attribute EventHandler onselectionchange;
    attribute EventHandler onselectstart;
    attribute EventHandler onwheel;
};

Document implements GlobalEventHandlers;
Document implements ParentNode;
Document implements NonElementParentNode;
Document implements DocumentOrShadowRoot;