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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is:
* https://dom.spec.whatwg.org/#interface-document
* https://html.spec.whatwg.org/multipage/#the-document-object
*/
// https://dom.spec.whatwg.org/#interface-document
[Constructor]
interface Document : Node {
[SameObject]
readonly attribute DOMImplementation implementation;
[Constant]
readonly attribute USVString URL;
[Constant]
readonly attribute USVString documentURI;
// readonly attribute USVString origin;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
readonly attribute DOMString charset; // legacy alias of .characterSet
readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
[Constant]
readonly attribute DOMString contentType;
[Pure]
readonly attribute DocumentType? doctype;
[Pure]
readonly attribute Element? documentElement;
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString qualifiedName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, NewObject, Throws]
Element createElement(DOMString localName, optional ElementCreationOptions options);
[CEReactions, NewObject, Throws]
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
[NewObject]
DocumentFragment createDocumentFragment();
[NewObject]
Text createTextNode(DOMString data);
[NewObject]
Comment createComment(DOMString data);
[NewObject, Throws]
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
[CEReactions, NewObject, Throws]
Node importNode(Node node, optional boolean deep = false);
[CEReactions, Throws]
Node adoptNode(Node node);
[NewObject, Throws]
Attr createAttribute(DOMString localName);
[NewObject, Throws]
Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName);
[NewObject, Throws]
Event createEvent(DOMString interface_);
[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);
};
Document implements NonElementParentNode;
Document implements ParentNode;
enum DocumentReadyState { "loading", "interactive", "complete" };
dictionary ElementCreationOptions {
DOMString is;
};
// https://html.spec.whatwg.org/multipage/#the-document-object
// [OverrideBuiltins]
partial /*sealed*/ interface Document {
// resource metadata management
[/*PutForwards=href, */Unforgeable]
readonly attribute Location? location;
[SetterThrows] attribute DOMString domain;
readonly attribute DOMString referrer;
[Throws]
attribute DOMString cookie;
readonly attribute DOMString lastModified;
readonly attribute DocumentReadyState readyState;
// DOM tree accessors
getter object (DOMString name);
[CEReactions]
attribute DOMString title;
// [CEReactions]
// attribute DOMString dir;
[CEReactions, SetterThrows]
attribute HTMLElement? body;
readonly attribute HTMLHeadElement? head;
[SameObject]
readonly attribute HTMLCollection images;
[SameObject]
readonly attribute HTMLCollection embeds;
[SameObject]
readonly attribute HTMLCollection plugins;
[SameObject]
readonly attribute HTMLCollection links;
[SameObject]
readonly attribute HTMLCollection forms;
[SameObject]
readonly attribute HTMLCollection scripts;
NodeList getElementsByName(DOMString elementName);
readonly attribute HTMLScriptElement? currentScript;
// dynamic markup insertion
[CEReactions, Throws]
Document open(optional DOMString type = "text/html", optional DOMString replace = "");
// WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
[CEReactions, Throws]
void close();
[CEReactions, Throws]
void write(DOMString... text);
[CEReactions, Throws]
void writeln(DOMString... text);
// user interaction
readonly attribute Window?/*Proxy?*/ defaultView;
readonly attribute Element? activeElement;
boolean hasFocus();
// [CEReactions]
// attribute DOMString designMode;
// [CEReactions]
// boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
// boolean queryCommandEnabled(DOMString commandId);
// boolean queryCommandIndeterm(DOMString commandId);
// boolean queryCommandState(DOMString commandId);
// boolean queryCommandSupported(DOMString commandId);
// DOMString queryCommandValue(DOMString commandId);
// special event handler IDL attributes that only apply to Document objects
[LenientThis] attribute EventHandler onreadystatechange;
// also has obsolete members
};
Document implements GlobalEventHandlers;
Document implements DocumentAndElementEventHandlers;
// https://html.spec.whatwg.org/multipage/#Document-partial
partial interface Document {
[CEReactions, TreatNullAs=EmptyString]
attribute DOMString fgColor;
// https://github.com/servo/servo/issues/8715
// [CEReactions, TreatNullAs=EmptyString]
// attribute DOMString linkColor;
// https://github.com/servo/servo/issues/8716
// [CEReactions, TreatNullAs=EmptyString]
// attribute DOMString vlinkColor;
// https://github.com/servo/servo/issues/8717
// [CEReactions, TreatNullAs=EmptyString]
// attribute DOMString alinkColor;
[CEReactions, TreatNullAs=EmptyString]
attribute DOMString bgColor;
[SameObject]
readonly attribute HTMLCollection anchors;
[SameObject]
readonly attribute HTMLCollection applets;
void clear();
void captureEvents();
void releaseEvents();
// Tracking issue for document.all: https://github.com/servo/servo/issues/7396
// readonly attribute HTMLAllCollection all;
};
// http://w3c.github.io/touch-events/#idl-def-Document
partial interface Document {
Touch createTouch(Window/*Proxy*/ view,
EventTarget target,
long identifier,
double pageX,
double pageY,
double screenX,
double screenY);
TouchList createTouchList(Touch... touches);
};
// https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint
partial interface Document {
Element? elementFromPoint(double x, double y);
sequence<Element> elementsFromPoint(double x, double y);
};
// https://drafts.csswg.org/cssom/#extensions-to-the-document-interface
partial interface Document {
[SameObject] readonly attribute StyleSheetList styleSheets;
};
// https://fullscreen.spec.whatwg.org/#api
partial interface Document {
[LenientSetter] readonly attribute boolean fullscreenEnabled;
[LenientSetter] readonly attribute Element? fullscreenElement;
[LenientSetter] readonly attribute boolean fullscreen; // historical
Promise<void> exitFullscreen();
attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};
|