/* * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. * Copyright (C) 2006, 2007 Samuel Weinig * * 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, 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. HTMLCollection getElementsByTagName(DOMString localName); // Introduced in DOM Level 2: [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false); [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName); [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString? qualifiedName); // Removed from DOM4. HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName); [PerWorldBindings] Element getElementById(DOMString elementId); // DOM Level 3 Core [MeasureAs=DocumentInputEncoding] readonly attribute DOMString? inputEncoding; // Removed from DOM4. [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; // Removed from DOM4. [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4. [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4. [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node); [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, TypeChecking=Interface] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); // 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, [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, TypeChecking=Interface] 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] NodeList getElementsByName([Default=Undefined] optional DOMString elementName); [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(); readonly attribute DOMString? characterSet; // WebKit extensions readonly attribute DOMString? preferredStylesheetSet; 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; // 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 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, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension); [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, 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;