blob: dda7a1d2fbcf145c99a476852ccc933152354137 [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.
*/
[
CustomToJSObject,
JSGenerateToNativeObject,
JSInlineGetOwnPropertySlot
] interface Document : Node {
// DOM Level 1 Core
readonly attribute DocumentType doctype;
readonly attribute DOMImplementation implementation;
readonly attribute Element documentElement;
[ReturnNewObject]
Element createElement([TreatNullAs=NullString,Default=Undefined] optional DOMString tagName)
raises (DOMException);
DocumentFragment createDocumentFragment();
[ReturnNewObject] Text createTextNode([Default=Undefined] optional DOMString data);
[ReturnNewObject] Comment createComment([Default=Undefined] optional DOMString data);
[ReturnNewObject] CDATASection createCDATASection([Default=Undefined] optional DOMString data)
raises(DOMException);
[ObjCLegacyUnnamedParameters, ReturnNewObject] ProcessingInstruction createProcessingInstruction([Default=Undefined] optional DOMString target,
[Default=Undefined] optional DOMString data)
raises (DOMException);
[ReturnNewObject] Attr createAttribute([Default=Undefined] optional DOMString name)
raises (DOMException);
[ReturnNewObject] EntityReference createEntityReference([Default=Undefined] optional DOMString name)
raises(DOMException);
NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname);
// Introduced in DOM Level 2:
[ObjCLegacyUnnamedParameters, ReturnNewObject]
Node importNode([Default=Undefined] optional Node importedNode,
optional boolean deep)
raises (DOMException);
[ObjCLegacyUnnamedParameters, ReturnNewObject]
Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName)
raises (DOMException);
[ObjCLegacyUnnamedParameters, ReturnNewObject] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName)
raises (DOMException);
[ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
Element getElementById([Default=Undefined] optional DOMString elementId);
// DOM Level 3 Core
[TreatReturnedNullStringAs=Null] readonly attribute DOMString inputEncoding;
[TreatReturnedNullStringAs=Null] readonly attribute DOMString xmlEncoding;
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString xmlVersion
setter raises (DOMException);
attribute boolean xmlStandalone
setter raises (DOMException);
Node adoptNode([Default=Undefined] optional Node source)
raises (DOMException);
#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.
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] attribute DOMString documentURI;
#else
[TreatReturnedNullStringAs=Null] readonly attribute DOMString documentURI;
#endif
// DOM Level 2 Events (DocumentEvents interface)
Event createEvent([Default=Undefined] optional DOMString eventType)
raises(DOMException);
// DOM Level 2 Tranversal and Range (DocumentRange interface)
Range createRange();
// DOM Level 2 Tranversal and Range (DocumentTraversal interface)
[ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator([Default=Undefined] optional Node root,
[Default=Undefined] optional unsigned long whatToShow,
[Default=Undefined] optional NodeFilter filter,
[Default=Undefined] optional boolean expandEntityReferences)
raises(DOMException);
[ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker([Default=Undefined] optional Node root,
[Default=Undefined] optional unsigned long whatToShow,
[Default=Undefined] optional NodeFilter filter,
[Default=Undefined] optional boolean expandEntityReferences)
raises(DOMException);
// 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)
[ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
[Default=Undefined] optional DOMString pseudoElement);
// DOM Level 3 XPath (XPathEvaluator interface)
[ObjCLegacyUnnamedParameters] XPathExpression createExpression([Default=Undefined] optional DOMString expression,
[Default=Undefined] optional XPathNSResolver resolver)
raises(DOMException);
XPathNSResolver createNSResolver(Node nodeResolver);
[ObjCLegacyUnnamedParameters] XPathResult evaluate([Default=Undefined] optional DOMString expression,
[Default=Undefined] optional Node contextNode,
[Default=Undefined] optional XPathNSResolver resolver,
[Default=Undefined] optional unsigned short type,
[Default=Undefined] optional XPathResult inResult)
raises(DOMException);
// Common extensions
boolean execCommand([Default=Undefined] optional DOMString command,
[Default=Undefined] optional boolean userInterface,
[TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString value);
#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
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] attribute DOMString title;
readonly attribute DOMString referrer;
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
[TreatNullAs=NullString] attribute DOMString domain
setter raises (DOMException);
#else
readonly attribute DOMString domain;
#endif
readonly attribute DOMString URL;
[TreatNullAs=NullString] attribute DOMString cookie
setter raises (DOMException),
getter raises (DOMException);
attribute HTMLElement body
setter raises (DOMException);
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;
NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
[Conditional=MICRODATA] NodeList getItems([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString typeNames);
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
[Custom] attribute Location location;
#endif
// IE extensions
[TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
[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
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
DOMSelection getSelection();
#endif
[TreatReturnedNullStringAs=Null] readonly attribute DOMString characterSet;
// WebKit extensions
[TreatReturnedNullStringAs=Null] readonly attribute DOMString preferredStylesheetSet;
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString] 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_CPP) || !LANGUAGE_CPP
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
CanvasRenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
#endif
#endif
// HTML 5
NodeList getElementsByClassName([Default=Undefined] optional DOMString tagname);
readonly attribute DOMString compatMode;
// NodeSelector - Selector API
Element querySelector(DOMString selectors)
raises(DOMException);
NodeList querySelectorAll(DOMString selectors)
raises(DOMException);
#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 webkitExitPointerLock();
[Conditional=POINTER_LOCK] readonly attribute Element webkitPointerLockElement;
[Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows();
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
[Conditional=FONT_LOAD_EVENTS] readonly attribute FontLoader fontloader;
#endif
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
// Event handler DOM attributes
[NotEnumerable] attribute EventListener onabort;
[NotEnumerable] attribute EventListener onblur;
[NotEnumerable] attribute EventListener onchange;
[NotEnumerable] attribute EventListener onclick;
[NotEnumerable] attribute EventListener oncontextmenu;
[NotEnumerable] attribute EventListener ondblclick;
[NotEnumerable] attribute EventListener ondrag;
[NotEnumerable] attribute EventListener ondragend;
[NotEnumerable] attribute EventListener ondragenter;
[NotEnumerable] attribute EventListener ondragleave;
[NotEnumerable] attribute EventListener ondragover;
[NotEnumerable] attribute EventListener ondragstart;
[NotEnumerable] attribute EventListener ondrop;
[NotEnumerable] attribute EventListener onerror;
[NotEnumerable] attribute EventListener onfocus;
[NotEnumerable] attribute EventListener oninput;
[NotEnumerable] attribute EventListener oninvalid;
[NotEnumerable] attribute EventListener onkeydown;
[NotEnumerable] attribute EventListener onkeypress;
[NotEnumerable] attribute EventListener onkeyup;
[NotEnumerable] attribute EventListener onload;
[NotEnumerable] attribute EventListener onmousedown;
[NotEnumerable] attribute EventListener onmouseenter;
[NotEnumerable] attribute EventListener onmouseleave;
[NotEnumerable] attribute EventListener onmousemove;
[NotEnumerable] attribute EventListener onmouseout;
[NotEnumerable] attribute EventListener onmouseover;
[NotEnumerable] attribute EventListener onmouseup;
[NotEnumerable] attribute EventListener onmousewheel;
[NotEnumerable] attribute EventListener onreadystatechange;
[NotEnumerable] attribute EventListener onscroll;
[NotEnumerable] attribute EventListener onselect;
[NotEnumerable] attribute EventListener onsubmit;
// attribute [NotEnumerable] EventListener oncanplay;
// attribute [NotEnumerable] EventListener oncanplaythrough;
// attribute [NotEnumerable] EventListener ondurationchange;
// attribute [NotEnumerable] EventListener onemptied;
// attribute [NotEnumerable] EventListener onended;
// attribute [NotEnumerable] EventListener onloadeddata;
// attribute [NotEnumerable] EventListener onloadedmetadata;
// attribute [NotEnumerable] EventListener onloadstart;
// attribute [NotEnumerable] EventListener onpause;
// attribute [NotEnumerable] EventListener onplay;
// attribute [NotEnumerable] EventListener onplaying;
// attribute [NotEnumerable] EventListener onprogress;
// attribute [NotEnumerable] EventListener onratechange;
// attribute [NotEnumerable] EventListener onseeked;
// attribute [NotEnumerable] EventListener onseeking;
// attribute [NotEnumerable] EventListener onshow;
// attribute [NotEnumerable] EventListener onstalled;
// attribute [NotEnumerable] EventListener onsuspend;
// attribute [NotEnumerable] EventListener ontimeupdate;
// attribute [NotEnumerable] EventListener onvolumechange;
// attribute [NotEnumerable] EventListener onwaiting;
// WebKit extensions
[NotEnumerable] attribute EventListener onbeforecut;
[NotEnumerable] attribute EventListener oncut;
[NotEnumerable] attribute EventListener onbeforecopy;
[NotEnumerable] attribute EventListener oncopy;
[NotEnumerable] attribute EventListener onbeforepaste;
[NotEnumerable] attribute EventListener onpaste;
[NotEnumerable] attribute EventListener onreset;
[NotEnumerable] attribute EventListener onsearch;
[NotEnumerable] attribute EventListener onselectstart;
[NotEnumerable] attribute EventListener onselectionchange;
[NotEnumerable,Conditional=TOUCH_EVENTS] attribute EventListener ontouchstart;
[NotEnumerable,Conditional=TOUCH_EVENTS] attribute EventListener ontouchmove;
[NotEnumerable,Conditional=TOUCH_EVENTS] attribute EventListener ontouchend;
[NotEnumerable,Conditional=TOUCH_EVENTS] attribute EventListener ontouchcancel;
[NotEnumerable, Conditional=FULLSCREEN_API] attribute EventListener onwebkitfullscreenchange;
[NotEnumerable, Conditional=FULLSCREEN_API] attribute EventListener onwebkitfullscreenerror;
[NotEnumerable, Conditional=POINTER_LOCK] attribute EventListener onwebkitpointerlockchange;
[NotEnumerable, Conditional=POINTER_LOCK] attribute EventListener onwebkitpointerlockerror;
[NotEnumerable, Conditional=CSP_NEXT] attribute EventListener onsecuritypolicyviolation;
#endif
#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
[ReturnNewObject] Touch createTouch([Default=Undefined] optional DOMWindow 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)
raises (DOMException);
[ReturnNewObject, Custom] TouchList createTouchList()
raises (DOMException);
#endif
#if defined(ENABLE_CUSTOM_ELEMENTS) && ENABLE_CUSTOM_ELEMENTS
[Conditional=CUSTOM_ELEMENTS, ImplementedAs=registerElement, CallWith=ScriptState]
CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options) raises(DOMException);
[ReturnNewObject]
Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension) raises (DOMException);
[ReturnNewObject]
Element createElementNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName,
[TreatNullAs=NullString] DOMString typeExtension) raises (DOMException);
#endif
#if defined(LANGUAGE_CPP) && LANGUAGE_CPP
// Extra WebCore methods exposed to allow compile-time casting in C++
boolean isHTMLDocument();
#endif
// Page visibility API.
[Conditional=PAGE_VISIBILITY_API] readonly attribute DOMString webkitVisibilityState;
[Conditional=PAGE_VISIBILITY_API] readonly attribute boolean webkitHidden;
// Security Policy API: http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-interfaces
[Conditional=CSP_NEXT] readonly attribute DOMSecurityPolicy securityPolicy;
};