/* * 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=ScriptExecutionContext, CustomToJSObject, JSCustomHeader, JSGenerateToNativeObject, ExportMacro=WEBCORE_EXPORT, ] interface Document : Node { // DOM Level 1 Core readonly attribute DocumentType? doctype; readonly attribute DOMImplementation implementation; readonly attribute Element? documentElement; [NewObject, RaisesException, ImplementedAs=createElementForBindings] Element createElement(DOMString tagName); [NewObject] DocumentFragment createDocumentFragment(); // FIXME: Using "undefined" as default parameter value is wrong. [NewObject] Text createTextNode(optional DOMString data = "undefined"); [NewObject] Comment createComment(optional DOMString data = "undefined"); [NewObject, RaisesException] CDATASection createCDATASection(optional DOMString data = "undefined"); [ObjCLegacyUnnamedParameters, NewObject, RaisesException] ProcessingInstruction createProcessingInstruction(optional DOMString target = "undefined", optional DOMString data = "undefined"); [NewObject, RaisesException] Attr createAttribute(optional DOMString name = "undefined"); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [RaisesException] EntityReference createEntityReference(optional DOMString name); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString tagname); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByTagName(optional DOMString tagname = "undefined"); #endif // Introduced in DOM Level 2: [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode(Node importedNode, optional boolean deep = false); // FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString]. // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS(optional DOMString? namespaceURI = null, [TreatNullAs=EmptyString] optional DOMString qualifiedName = "undefined"); // FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString]. // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS(optional DOMString? namespaceURI = null, [TreatNullAs=EmptyString] optional DOMString qualifiedName = "undefined"); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByTagNameNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); #endif // DOM Level 3 Core [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString inputEncoding; readonly attribute DOMString? xmlEncoding; [SetterRaisesException] attribute DOMString? xmlVersion; [SetterRaisesException] attribute boolean xmlStandalone; [RaisesException] Node adoptNode(Node source); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT // document.documentURI was writable in DOM3 Core, but is read-only in DOM4 // (see http://www.w3.org/TR/2011/WD-dom-20110915/#document). We need to keep // the writable version around for Objective C clients, but are moving to // read-only for other clients. attribute DOMString? documentURI; #else [ImplementedAs=urlForBindings] readonly attribute DOMString documentURI; #endif // DOM Level 2 Events (DocumentEvents interface) // FIXME: Using "undefined" as default parameter value is wrong. [RaisesException, NewObject] Event createEvent(optional DOMString eventType = "undefined"); // DOM Level 2 Tranversal and Range (DocumentRange interface) [NewObject] Range createRange(); // DOM Level 2 Tranversal and Range (DocumentTraversal interface) #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT [ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter, optional boolean expandEntityReferences); [ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter, optional boolean expandEntityReferences); #else [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); #endif // DOM Level 2 Abstract Views (DocumentView interface) readonly attribute DOMWindow defaultView; // DOM Level 2 Style (DocumentStyle interface) readonly attribute StyleSheetList styleSheets; // DOM Level 2 Style (DocumentCSS interface) // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined"); readonly attribute DOMString contentType; // DOM Level 3 XPath (XPathEvaluator interface) // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined", optional XPathNSResolver? resolver); XPathNSResolver createNSResolver(Node? nodeResolver); // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate(optional DOMString expression = "undefined", optional Node? contextNode, optional XPathNSResolver? resolver, optional unsigned short type = 0, optional XPathResult? inResult); // Common extensions // FIXME: Using "undefined" as default parameter value is wrong. boolean execCommand(optional DOMString command = "undefined", optional boolean userInterface = false, optional DOMString? value = null); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // FIXME: remove the these two versions once optional is implemented for Objective-C. boolean execCommand(DOMString command, boolean userInterface); boolean execCommand(DOMString command); #endif // FIXME: Using "undefined" as default parameter value is wrong. boolean queryCommandEnabled(optional DOMString command = "undefined"); boolean queryCommandIndeterm(optional DOMString command = "undefined"); boolean queryCommandState(optional DOMString command = "undefined"); boolean queryCommandSupported(optional DOMString command = "undefined"); DOMString queryCommandValue(optional DOMString command = "undefined"); // Moved down from HTMLDocument // FIXME: Should not have [TreatNullAs=EmptyString]. [TreatNullAs=EmptyString] attribute DOMString title; readonly attribute DOMString referrer; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // FIXME: Should not have [TreatNullAs=EmptyString]. [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString domain; #else readonly attribute DOMString domain; #endif [ImplementedAs=urlForBindings] readonly attribute DOMString URL; // FIXME: Should not have [TreatNullAs=EmptyString]. [TreatNullAs=EmptyString, GetterRaisesException, SetterRaisesException] attribute DOMString cookie; [SetterRaisesException, ImplementedAs=bodyOrFrameset, StrictTypeChecking] 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; // FIXME: Using "undefined" as default parameter value is wrong. NodeList getElementsByName([AtomicString] optional DOMString elementName = "undefined"); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [PutForwards=href, Unforgeable] readonly attribute Location? location; #endif // IE extensions #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT attribute DOMString charset; #else [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString charset; #endif readonly attribute DOMString defaultCharset; readonly attribute DOMString readyState; Element elementFromPoint(optional long x = 0, optional long y = 0); Range caretRangeFromPoint(optional long x = 0, optional long y = 0); // Mozilla extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT DOMSelection getSelection(); #endif [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString characterSet; // WebKit extensions readonly attribute DOMString? preferredStylesheetSet; attribute DOMString? selectedStylesheetSet; #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT CSSStyleDeclaration createCSSStyleDeclaration(); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // DOM Level 2 Style Interface [ObjCLegacyUnnamedParameters, ObjCUseDefaultView] CSSStyleDeclaration getComputedStyle(Element? element, DOMString pseudoElement); // WebKit extension // FIXME: remove the first version once optional is implemented for Objective-C. [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element? element, DOMString pseudoElement); [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(Element? element, DOMString pseudoElement, optional boolean authorOnly); #endif #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C CanvasRenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height); #endif // HTML 5 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString classNames); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByClassName(optional DOMString classNames = "undefined"); #endif readonly attribute Element? activeElement; boolean hasFocus(); readonly attribute DOMString compatMode; #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API // Mozilla version readonly attribute boolean webkitIsFullScreen; readonly attribute boolean webkitFullScreenKeyboardInputAllowed; readonly attribute Element webkitCurrentFullScreenElement; void webkitCancelFullScreen(); // W3C version readonly attribute boolean webkitFullscreenEnabled; readonly attribute Element? webkitFullscreenElement; void webkitExitFullscreen(); #endif [Conditional=POINTER_LOCK] void exitPointerLock(); [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement; [Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows(); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT readonly attribute FontFaceSet fonts; #endif #if defined(ENABLE_IOS_TOUCH_EVENTS) && ENABLE_IOS_TOUCH_EVENTS #include #elif defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS [NewObject, RaisesException] 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 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [Custom, RaisesException, Conditional=CUSTOM_ELEMENTS, EnabledAtRuntime=CustomElements] void defineElement(DOMString localName, Function constructor); #endif // Page visibility API. readonly attribute DOMString visibilityState; readonly attribute boolean hidden; // 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 DOMString origin; // http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement readonly attribute Element? scrollingElement; // Event Handlers // 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 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=CSP_NEXT] attribute EventHandler onsecuritypolicyviolation; [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockchange; [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockerror; }; Document implements ParentNode; Document implements NonElementParentNode; Document implements GlobalEventHandlers;