/* * Copyright (C) 2006, 2007, 2011, 2015 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. */ [ Constructor, ConstructorCallWith=Document, CustomToJSObject, ExportMacro=WEBCORE_EXPORT, JSCustomHeader, JSCustomMarkFunction, JSGenerateToNativeObject, ] interface Document : Node { readonly attribute DocumentType? doctype; readonly attribute DOMImplementation implementation; [DOMJIT=Getter] readonly attribute Element? documentElement; [NewObject, MayThrowException, ImplementedAs=createElementForBindings] Element createElement(DOMString tagName); [NewObject] DocumentFragment createDocumentFragment(); [NewObject] Text createTextNode(DOMString data); [NewObject] Comment createComment(DOMString data); [NewObject, MayThrowException] CDATASection createCDATASection(DOMString data); [NewObject, MayThrowException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); [NewObject, MayThrowException] Attr createAttribute(DOMString name); HTMLCollection getElementsByTagName(DOMString tagname); [CEReactions, MayThrowException, NewObject] Node importNode(Node importedNode, optional boolean deep = false); [NewObject, MayThrowException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName); [NewObject, MayThrowException] Attr createAttributeNS(DOMString? namespaceURI, DOMString qualifiedName); HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName); [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString inputEncoding; readonly attribute DOMString? xmlEncoding; [SetterMayThrowException] attribute DOMString? xmlVersion; attribute boolean xmlStandalone; [CEReactions, MayThrowException] Node adoptNode(Node source); [ImplementedAs=urlForBindings] readonly attribute USVString documentURI; [MayThrowException, NewObject] Event createEvent(DOMString eventType); [NewObject] Range createRange(); [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); readonly attribute DOMWindow defaultView; readonly attribute StyleSheetList styleSheets; // FIXME: Using "undefined" as default parameter value is wrong. CSSStyleDeclaration getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined"); readonly attribute DOMString contentType; // FIXME: Using "undefined" as default parameter value is wrong. [MayThrowException] XPathExpression createExpression(optional DOMString expression = "undefined", optional XPathNSResolver? resolver); XPathNSResolver createNSResolver(Node? nodeResolver); // FIXME: Using "undefined" as default parameter value is wrong. [MayThrowException] XPathResult evaluate(optional DOMString expression = "undefined", optional Node? contextNode, optional XPathNSResolver? resolver, optional unsigned short type = 0, optional XPathResult? inResult); // FIXME: The default value for the last parameter should be the empty string. [CEReactions] boolean execCommand(DOMString command, optional boolean userInterface = false, optional DOMString? value = null); boolean queryCommandEnabled(DOMString command); boolean queryCommandIndeterm(DOMString command); boolean queryCommandState(DOMString command); boolean queryCommandSupported(DOMString command); DOMString queryCommandValue(DOMString command); [CEReactions] attribute DOMString title; attribute DOMString dir; attribute DOMString designMode; readonly attribute USVString referrer; [SetterMayThrowException] attribute USVString domain; [ImplementedAs=urlForBindings] readonly attribute USVString URL; [GetterMayThrowException, SetterMayThrowException] attribute USVString cookie; [CEReactions, DOMJIT=Getter, ImplementedAs=bodyOrFrameset, SetterMayThrowException] 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 HTMLCollection embeds; readonly attribute HTMLCollection plugins; readonly attribute HTMLCollection scripts; readonly attribute DOMString lastModified; NodeList getElementsByName([AtomicString] DOMString elementName); [PutForwards=href, Unforgeable] readonly attribute Location? location; [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString charset; readonly attribute DOMString readyState; Range caretRangeFromPoint(optional long x = 0, optional long y = 0); // Mozilla extensions DOMSelection getSelection(); [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString characterSet; readonly attribute DOMString? preferredStylesheetSet; attribute DOMString? selectedStylesheetSet; // FIXME: This is not standard and has been dropped from Blink already. [Custom] (CanvasRenderingContext2D or WebGLRenderingContextBase) getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); HTMLCollection getElementsByClassName(DOMString classNames); boolean hasFocus(); readonly attribute DOMString compatMode; #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API // Mozilla version readonly attribute boolean webkitIsFullScreen; readonly attribute boolean webkitFullScreenKeyboardInputAllowed; [ImplementedAs=webkitCurrentFullScreenElementForBindings] readonly attribute Element webkitCurrentFullScreenElement; void webkitCancelFullScreen(); // W3C version readonly attribute boolean webkitFullscreenEnabled; [ImplementedAs=webkitFullscreenElementForBindings] readonly attribute Element? webkitFullscreenElement; void webkitExitFullscreen(); #endif [Conditional=POINTER_LOCK] void exitPointerLock(); [Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows(); readonly attribute FontFaceSet fonts; #if defined(ENABLE_IOS_TOUCH_EVENTS) && ENABLE_IOS_TOUCH_EVENTS #include #elif defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS [NewObject] Touch createTouch(optional DOMWindow? window = null, optional EventTarget? target = null, optional long identifier = 0, optional long pageX = 0, optional long pageY = 0, optional long screenX = 0, optional long screenY = 0, optional long webkitRadiusX = 0, optional long webkitRadiusY = 0, optional unrestricted float webkitRotationAngle = NaN, optional unrestricted float webkitForce = NaN); [NewObject, Custom] TouchList createTouchList(Touch... touches); #endif // Page visibility API. readonly attribute VisibilityState visibilityState; readonly attribute boolean hidden; attribute EventHandler onvisibilitychange; // currentscript API: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-currentscript readonly attribute HTMLScriptElement? currentScript; // http://www.w3.org/TR/2014/WD-dom-20140204/#dom-document-origin readonly attribute USVString origin; // http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement readonly attribute Element? scrollingElement; // Unique to Element and Document // FIXME: Should these be exposed on Window as well (and therefore moved to GlobalEventHandlers.idl)? [NotEnumerable] attribute EventHandler onbeforecopy; [NotEnumerable] attribute EventHandler onbeforecut; [NotEnumerable] attribute EventHandler onbeforeinput; [NotEnumerable] attribute EventHandler onbeforepaste; [NotEnumerable] attribute EventHandler oncopy; [NotEnumerable] attribute EventHandler oncut; [NotEnumerable] attribute EventHandler onpaste; [NotEnumerable] attribute EventHandler onselectstart; [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenchange; [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenerror; // Unique to Document and HTMLBodyElement [NotEnumerable] attribute EventHandler onselectionchange; // Unique to Document [LenientThis] attribute EventHandler onreadystatechange; [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockchange; [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockerror; }; enum VisibilityState { "hidden", "visible", "prerender" }; Document implements ParentNode; Document implements NonElementParentNode; Document implements DocumentOrShadowRoot; Document implements GlobalEventHandlers;