blob: 64f4ddf8b9a66ea2de5ea96c8e65a78ced050102 [file] [log] [blame]
/*
* 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.
[DartNoAutoScope] 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, DartNoAutoScope] 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, DartNoAutoScope] 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, DartNoAutoScope] 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, DartCustom] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
[CustomElementCallbacks, LogActivity, RaisesException, DartCustom] 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;