blob: bea2b66b88ee716e8cc0bfebdf7af983c338da79 [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 ();
[
CustomToV8
] interface Document : Node {
// DOM Level 1 Core
readonly attribute DocumentType doctype;
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElement([TreatNullAs=NullString,Default=Undefined] optional DOMString tagName);
DocumentFragment createDocumentFragment();
[PerWorldBindings] Text createTextNode([Default=Undefined] optional DOMString data);
Comment createComment([Default=Undefined] optional DOMString data);
[RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
[RaisesException] ProcessingInstruction createProcessingInstruction([Default=Undefined] optional DOMString target,
[Default=Undefined] optional DOMString data);
[RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
[PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname);
// Introduced in DOM Level 2:
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
optional boolean deep);
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName);
[RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4.
NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[PerWorldBindings] Element getElementById([Default=Undefined] optional 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, SetterRaisesException, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4.
[SetterRaisesException, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
[RaisesException, CustomElementCallbacks=Enable] Node adoptNode([Default=Undefined] optional Node source);
[TreatReturnedNullStringAs=Null] readonly attribute DOMString documentURI;
// DOM Level 2 Events (DocumentEvents interface)
[RaisesException] Event createEvent([Default=Undefined] optional DOMString eventType);
// DOM Level 2 Traversal and Range (DocumentRange interface)
Range createRange();
// DOM Level 2 Traversal and Range (DocumentTraversal interface)
// In DOM4, the fourth argument |expandEntityReferences| is removed.
// Historically, this argument was never implemented and has been ignored.
// We still receive the argument to keep compatibility, but don't do anything if it's specified.
[RaisesException] NodeIterator createNodeIterator(Node root,
optional unsigned long whatToShow,
optional NodeFilter filter,
optional boolean expandEntityReferences);
[RaisesException] TreeWalker createTreeWalker(Node root,
optional unsigned long whatToShow,
optional NodeFilter filter,
optional boolean expandEntityReferences);
// DOM Level 2 Abstract Views (DocumentView interface)
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);
// Common extensions
[CustomElementCallbacks=Enable]
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=Enable] attribute DOMString title;
readonly attribute DOMString referrer;
[TreatNullAs=NullString, SetterRaisesException] attribute DOMString domain;
readonly attribute DOMString URL;
[TreatNullAs=NullString, GetterRaisesException, SetterRaisesException] attribute DOMString cookie;
[SetterRaisesException, CustomElementCallbacks=Enable] attribute HTMLElement body;
readonly attribute HTMLHeadElement head;
readonly attribute HTMLCollection images;
readonly attribute HTMLCollection applets;
readonly attribute HTMLCollection links;
readonly attribute HTMLCollection forms;
readonly attribute HTMLCollection anchors;
readonly attribute DOMString lastModified;
[PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
[Custom, Replaceable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds] readonly attribute Location location;
// IE extensions
[MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
[MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
[TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
Element elementFromPoint([Default=Undefined] optional long x,
[Default=Undefined] optional long y);
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;
CanvasRenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
// HTML 5
NodeList getElementsByClassName([Default=Undefined] optional DOMString tagname);
readonly attribute DOMString compatMode;
// NodeSelector - Selector API
[RaisesException] Element querySelector(DOMString selectors);
[RaisesException] NodeList querySelectorAll(DOMString selectors);
void webkitExitPointerLock();
readonly attribute Element webkitPointerLockElement;
[EnabledAtRuntime=cssRegions] WebKitNamedFlowCollection webkitGetNamedFlows();
[EnabledAtRuntime=fontLoadEvents] readonly attribute FontLoader fontloader;
// Event handler DOM attributes
[NotEnumerable] attribute EventHandler onabort;
[NotEnumerable] attribute EventHandler onblur;
[NotEnumerable] attribute EventHandler onchange;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onclick;
[NotEnumerable] attribute EventHandler oncontextmenu;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondblclick;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrag;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragend;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragenter;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragleave;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragover;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragstart;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrop;
[NotEnumerable] attribute EventHandler onerror;
[NotEnumerable] attribute EventHandler onfocus;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler oninput;
[NotEnumerable] attribute EventHandler oninvalid;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeydown;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeypress;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeyup;
[NotEnumerable] attribute EventHandler onload;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousedown;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseenter;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseleave;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousemove;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseout;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseover;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseup;
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; // Deprecated in favor of onwheel.
[NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onwheel;
[NotEnumerable] attribute EventHandler onreadystatechange;
[NotEnumerable] attribute EventHandler onscroll;
[NotEnumerable] attribute EventHandler onselect;
[NotEnumerable] attribute EventHandler onsubmit;
// attribute [NotEnumerable] EventHandler oncanplay;
// attribute [NotEnumerable] EventHandler oncanplaythrough;
// attribute [NotEnumerable] EventHandler ondurationchange;
// attribute [NotEnumerable] EventHandler onemptied;
// attribute [NotEnumerable] EventHandler onended;
// attribute [NotEnumerable] EventHandler onloadeddata;
// attribute [NotEnumerable] EventHandler onloadedmetadata;
// attribute [NotEnumerable] EventHandler onloadstart;
// attribute [NotEnumerable] EventHandler onpause;
// attribute [NotEnumerable] EventHandler onplay;
// attribute [NotEnumerable] EventHandler onplaying;
// attribute [NotEnumerable] EventHandler onprogress;
// attribute [NotEnumerable] EventHandler onratechange;
// attribute [NotEnumerable] EventHandler onseeked;
// attribute [NotEnumerable] EventHandler onseeking;
// attribute [NotEnumerable] EventHandler onshow;
// attribute [NotEnumerable] EventHandler onstalled;
// attribute [NotEnumerable] EventHandler onsuspend;
// attribute [NotEnumerable] EventHandler ontimeupdate;
// attribute [NotEnumerable] EventHandler onvolumechange;
// attribute [NotEnumerable] EventHandler onwaiting;
// WebKit extensions
[NotEnumerable] attribute EventHandler onbeforecut;
[NotEnumerable] attribute EventHandler oncut;
[NotEnumerable] attribute EventHandler onbeforecopy;
[NotEnumerable] attribute EventHandler oncopy;
[NotEnumerable] attribute EventHandler onbeforepaste;
[NotEnumerable] attribute EventHandler onpaste;
[NotEnumerable] attribute EventHandler onreset;
[NotEnumerable] attribute EventHandler onsearch;
[NotEnumerable] attribute EventHandler onselectstart;
[NotEnumerable] attribute EventHandler onselectionchange;
[NotEnumerable,EnabledAtRuntime=touch] attribute EventHandler ontouchstart;
[NotEnumerable,EnabledAtRuntime=touch] attribute EventHandler ontouchmove;
[NotEnumerable,EnabledAtRuntime=touch] attribute EventHandler ontouchend;
[NotEnumerable,EnabledAtRuntime=touch] attribute EventHandler ontouchcancel;
[NotEnumerable] attribute EventHandler onwebkitfullscreenchange;
[NotEnumerable] attribute EventHandler onwebkitfullscreenerror;
[NotEnumerable] attribute EventHandler onwebkitpointerlockchange;
[NotEnumerable] attribute EventHandler onwebkitpointerlockerror;
[NotEnumerable, EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
[EnabledAtRuntime=touch] Touch createTouch([Default=Undefined] optional Window window,
[Default=Undefined] optional EventTarget target,
[Default=Undefined] optional long identifier,
[Default=Undefined] optional long pageX,
[Default=Undefined] optional long pageY,
[Default=Undefined] optional long screenX,
[Default=Undefined] optional long screenY,
[Default=Undefined] optional long webkitRadiusX,
[Default=Undefined] optional long webkitRadiusY,
[Default=Undefined] optional float webkitRotationAngle,
[Default=Undefined] optional float webkitForce);
[EnabledAtRuntime=touch, Custom, RaisesException] TouchList createTouchList();
[DeprecateAs=PrefixedDocumentRegister, EnabledAtRuntime=customElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
[EnabledAtRuntime=customElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor register(DOMString name, optional Dictionary options);
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
[CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName,
[TreatNullAs=NullString] DOMString typeExtension);
// Page visibility API.
readonly attribute DOMString webkitVisibilityState;
readonly attribute boolean webkitHidden;
// Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
[EnabledAtRuntime=experimentalContentSecurityPolicyFeatures] readonly attribute SecurityPolicy securityPolicy;
readonly attribute HTMLScriptElement currentScript;
};
Document implements ParentNode;