blob: f5f0b83a44808fd22817231265d1bb7a16135a39 [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 ();
[
SpecialWrapFor=HTMLDocument|SVGDocument
] interface Document : Node {
// DOM Level 1 Core
readonly attribute DocumentType doctype;
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
[CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, 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, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Node importNode([Default=Undefined] optional Node importedNode,
optional boolean deep);
[CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, 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, RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4.
[RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
[RaisesException, CustomElementCallbacks] 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)
[ImplementedAs=domWindow] 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]
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 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] 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);
[PerWorldBindings, ActivityLogging=ForIsolatedWorlds, PutForwards=href] 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;
[RuntimeEnabled=CSSRegions] WebKitNamedFlowCollection webkitGetNamedFlows();
// Event handler attributes
attribute EventHandler onbeforecopy;
attribute EventHandler onbeforecut;
attribute EventHandler onbeforepaste;
attribute EventHandler oncopy;
attribute EventHandler oncut;
attribute EventHandler onpaste;
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;
[PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] 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 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);
[RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
[DeprecateAs=PrefixedDocumentRegister, RuntimeEnabled=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
[RuntimeEnabled=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks, RaisesException] CustomElementConstructor register(DOMString name, optional Dictionary options);
[CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);
[CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] 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;
// Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
[RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] readonly attribute SecurityPolicy securityPolicy;
readonly attribute HTMLScriptElement currentScript;
};
Document implements GlobalEventHandlers;
Document implements ParentNode;