/
domcore.idl
411 lines (351 loc) · 15.1 KB
/
domcore.idl
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
// This is the DOM Core IDL from the 6/15 Working Draft
// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
//
// This file is used by ../tools/idl2domjs to generate domcore.js
//
// I've removed DOMException, since WebIDL implementation requirements
// for exceptions are not clear yet. For now see DOMException.js for a
// hand-written implementation.
//
// I've also changed the return type of HTMLCollection.namedItem() to
// Element? from object?. DOMCore includes a note that this method can
// only return elements, but for some historical reason must be declared
// with object. In our case we need the real element type, so this change
// must be made by hand.
//
// I've added dom.js specific methods (with moz prefix) to DOMImplementation
// to handle hooking up dom.js to a parser and a renderer
//
// I've put the HTMLDocument declaration from the HTML spec in this file, since
// it puts all of its members onto the Document object with an implemments
// declaration.
//
[Constructor(DOMString type, optional EventInit eventInitDict)]
interface Event {
readonly attribute DOMString type;
readonly attribute EventTarget? target;
readonly attribute EventTarget? currentTarget;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute unsigned short eventPhase;
void stopPropagation();
void stopImmediatePropagation();
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
void preventDefault();
readonly attribute boolean defaultPrevented;
readonly attribute boolean isTrusted;
readonly attribute DOMTimeStamp timeStamp;
void initEvent(DOMString type, boolean bubbles, boolean cancelable);
};
dictionary EventInit {
boolean bubbles;
boolean cancelable;
};
[Constructor(DOMString type, optional CustomEventInit eventInitDict)]
interface CustomEvent : Event {
readonly attribute any detail;
};
dictionary CustomEventInit : EventInit {
any detail;
};
interface EventTarget {
void addEventListener(DOMString type, EventListener? listener, optional boolean capture);
void removeEventListener(DOMString type, EventListener? listener, optional boolean capture);
boolean dispatchEvent(Event event);
};
[Callback, NoInterfaceObject]
interface EventListener {
void handleEvent(Event event);
};
interface Node : EventTarget {
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2; // historical
const unsigned short TEXT_NODE = 3;
const unsigned short CDATA_SECTION_NODE = 4; // historical
const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
const unsigned short ENTITY_NODE = 6; // historical
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
const unsigned short COMMENT_NODE = 8;
const unsigned short DOCUMENT_NODE = 9;
const unsigned short DOCUMENT_TYPE_NODE = 10;
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
const unsigned short NOTATION_NODE = 12; // historical
readonly attribute unsigned short nodeType;
readonly attribute DOMString nodeName;
readonly attribute DOMString baseURI;
readonly attribute Document? ownerDocument;
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
boolean hasChildNodes();
readonly attribute NodeList childNodes;
readonly attribute Node? firstChild;
readonly attribute Node? lastChild;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
unsigned short compareDocumentPosition(Node other);
attribute DOMString? nodeValue;
attribute DOMString? textContent;
Node insertBefore(Node newChild, Node? refChild);
Node replaceChild(Node newChild, Node oldChild);
Node removeChild(Node oldChild);
Node appendChild(Node newChild);
Node cloneNode(boolean deep);
boolean isSameNode(Node? node);
boolean isEqualNode(Node? node);
DOMString lookupPrefix([TreatNullAs=EmptyString] DOMString namespace);
DOMString lookupNamespaceURI(DOMString? prefix);
boolean isDefaultNamespace([TreatNullAs=EmptyString] DOMString namespace);
};
interface DocumentFragment : Node {
};
// The OverrideBuiltins attribute is from the HTML spec.
[OverrideBuiltins]
interface Document : Node {
// XXX: a few private methods that dom.js needs to expose
// This is a private method for registering a mutation handler on the
// document. The renderer uses this to track changes to the document tree.
void _setMutationHandler(MozMutationHandler handler);
// This is a private method that the renderer process uses to pass
// events back to dom.js so that they can be dispatched. Note that the
// target argument is a nid, not a node. Unlike the public
// EventTarget.dispatchEvent() method, this one dispatches trusted events
void _dispatchEvent(unsigned long target, DOMString type, EventInit details);
readonly attribute DOMImplementation implementation;
attribute DOMString documentURI;
readonly attribute DOMString compatMode;
readonly attribute DocumentType? doctype;
readonly attribute Element? documentElement;
NodeList getElementsByTagName(DOMString qualifiedName);
NodeList getElementsByTagNameNS(DOMString namespace, DOMString localName);
NodeList getElementsByClassName(DOMString classNames);
Element? getElementById(DOMString elementId);
Element createElement([TreatNullAs=EmptyString] DOMString localName);
Element createElementNS(DOMString namespace, DOMString qualifiedName);
DocumentFragment createDocumentFragment();
Text createTextNode(DOMString data);
Comment createComment(DOMString data);
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
Node importNode(Node node, boolean deep);
Node adoptNode(Node node);
Event createEvent(DOMString eventInterfaceName);
//
// The HTML spec says that all documents have the following members.
// Currently HTML says "Document implements HTMLDocument", but that may
// change to "partial interface Document", so I'm putting them directly
// in the Document interface here. Note that many of these HTML-defined
// members are commented out for now.
//
// resource metadata management
// XXX: this is breaking jstests.py, so it is commented out for now
// [PutForwards=href] readonly attribute Location? location;
readonly attribute DOMString URL;
attribute DOMString domain;
readonly attribute DOMString referrer;
attribute DOMString cookie;
readonly attribute DOMString lastModified;
readonly attribute DOMString readyState;
// DOM tree accessors
// XXX The getter is commented out for now, since
// I'm not ready to write DocumentProxy yet.
// getter any (in DOMString name);
attribute DOMString title;
attribute DOMString dir;
attribute HTMLElement? body;
readonly attribute HTMLHeadElement? head;
readonly attribute HTMLCollection images;
readonly attribute HTMLCollection embeds;
readonly attribute HTMLCollection plugins;
readonly attribute HTMLCollection links;
readonly attribute HTMLCollection forms;
readonly attribute HTMLCollection scripts;
NodeList getElementsByName(in DOMString elementName);
// NodeList getItems(in optional DOMString typeNames); // microdata
// readonly attribute DOMElementMap cssElementMap;
// dynamic markup insertion
attribute DOMString innerHTML;
// HTMLDocument open(in optional DOMString type, in optional DOMString replace);
// WindowProxy open(in DOMString url, in DOMString name, in DOMString features, in optional boolean replace);
// void close();
void write(in DOMString... text);
void writeln(in DOMString... text);
// user interaction
// readonly attribute WindowProxy? defaultView;
// readonly attribute Element? activeElement;
// boolean hasFocus();
// attribute DOMString designMode;
// boolean execCommand(in DOMString commandId);
// boolean execCommand(in DOMString commandId, in boolean showUI);
// boolean execCommand(in DOMString commandId, in boolean showUI, in DOMString value);
// boolean queryCommandEnabled(in DOMString commandId);
// boolean queryCommandIndeterm(in DOMString commandId);
// boolean queryCommandState(in DOMString commandId);
// boolean queryCommandSupported(in DOMString commandId);
// DOMString queryCommandValue(in DOMString commandId);
// readonly attribute HTMLCollection commands;
// event handler IDL attributes
attribute Function? onabort;
attribute Function? onblur;
attribute Function? oncanplay;
attribute Function? oncanplaythrough;
attribute Function? onchange;
attribute Function? onclick;
attribute Function? oncontextmenu;
attribute Function? oncuechange;
attribute Function? ondblclick;
attribute Function? ondrag;
attribute Function? ondragend;
attribute Function? ondragenter;
attribute Function? ondragleave;
attribute Function? ondragover;
attribute Function? ondragstart;
attribute Function? ondrop;
attribute Function? ondurationchange;
attribute Function? onemptied;
attribute Function? onended;
attribute Function? onerror;
attribute Function? onfocus;
attribute Function? oninput;
attribute Function? oninvalid;
attribute Function? onkeydown;
attribute Function? onkeypress;
attribute Function? onkeyup;
attribute Function? onload;
attribute Function? onloadeddata;
attribute Function? onloadedmetadata;
attribute Function? onloadstart;
attribute Function? onmousedown;
attribute Function? onmousemove;
attribute Function? onmouseout;
attribute Function? onmouseover;
attribute Function? onmouseup;
attribute Function? onmousewheel;
attribute Function? onpause;
attribute Function? onplay;
attribute Function? onplaying;
attribute Function? onprogress;
attribute Function? onratechange;
attribute Function? onreadystatechange;
attribute Function? onreset;
attribute Function? onscroll;
attribute Function? onseeked;
attribute Function? onseeking;
attribute Function? onselect;
attribute Function? onshow;
attribute Function? onstalled;
attribute Function? onsubmit;
attribute Function? onsuspend;
attribute Function? ontimeupdate;
attribute Function? onvolumechange;
attribute Function? onwaiting;
};
interface DOMImplementation {
boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version);
DocumentType createDocumentType([TreatNullAs=EmptyString] DOMString qualifiedName, DOMString publicId, DOMString systemId);
Document createDocument([TreatNullAs=EmptyString] DOMString namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype);
Document createHTMLDocument(DOMString title);
// non-standard methods for hooking documents to parsers and renderers
// dom.js will call handler() for any document changes.
void mozSetOutputMutationHandler(Document doc, MozMutationHandler handler);
// Return a handler that a parser can call to build up the document
MozMutationHandler mozGetInputMutationHandler(Document doc);
readonly attribute Function mozHTMLParser;
};
// Non-standard callback function type
[Callback, NoInterfaceObject]
interface MozMutationHandler {
void mutate(any mutation);
};
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
readonly attribute Attr[] attributes;
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString namespace, DOMString localName);
void setAttribute(DOMString qualifiedName, DOMString value);
void setAttributeNS(DOMString namespace, DOMString qualifiedName, DOMString value);
void removeAttribute(DOMString qualifiedName);
void removeAttributeNS(DOMString namespace, DOMString localName);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString namespace, DOMString localName);
NodeList getElementsByTagName(DOMString qualifiedName);
NodeList getElementsByTagNameNS(DOMString namespace, DOMString localName);
NodeList getElementsByClassName(DOMString classNames);
readonly attribute HTMLCollection children;
readonly attribute Element? firstElementChild;
readonly attribute Element? lastElementChild;
readonly attribute Element? previousElementSibling;
readonly attribute Element? nextElementSibling;
readonly attribute unsigned long childElementCount;
};
interface Attr {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString name;
attribute DOMString value;
};
interface DocumentType : Node {
readonly attribute DOMString name;
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
};
interface ProcessingInstruction : Node {
readonly attribute DOMString target;
attribute DOMString data;
};
interface CharacterData : Node {
[TreatNullAs=EmptyString] attribute DOMString data;
readonly attribute unsigned long length;
DOMString substringData(unsigned long offset, unsigned long count);
void appendData(DOMString data);
void insertData(unsigned long offset, DOMString data);
void deleteData(unsigned long offset, unsigned long count);
void replaceData(unsigned long offset, unsigned long count, DOMString data);
};
interface Text : CharacterData {
Text splitText(unsigned long offset);
readonly attribute DOMString wholeText;
Text? replaceWholeText(DOMString data);
};
interface Comment : CharacterData {
};
interface NodeList {
getter Node? item(unsigned long index);
readonly attribute unsigned long length;
};
interface HTMLCollection {
readonly attribute unsigned long length;
getter Element? item(unsigned long index);
getter Element? namedItem(DOMString name); // only returns Element
};
interface DOMStringList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString string);
};
interface DOMTokenList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString token);
void add(DOMString token);
void remove(DOMString token);
boolean toggle(DOMString token);
stringifier DOMString ();
};
interface DOMSettableTokenList : DOMTokenList {
attribute DOMString value;
};
[Callback=FunctionOnly, NoInterfaceObject]
interface Function {
any call(in any... arguments);
};