michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is: michael@0: * http://dom.spec.whatwg.org/#interface-document michael@0: * http://www.whatwg.org/specs/web-apps/current-work/#the-document-object michael@0: * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api michael@0: * http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface michael@0: * http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface michael@0: * http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface michael@0: * http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface michael@0: * michael@0: * http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/core/nsIDOMDocument.idl michael@0: */ michael@0: michael@0: interface WindowProxy; michael@0: interface nsISupports; michael@0: interface URI; michael@0: interface nsIDocShell; michael@0: michael@0: enum VisibilityState { "hidden", "visible" }; michael@0: michael@0: /* http://dom.spec.whatwg.org/#interface-document */ michael@0: [Constructor] michael@0: interface Document : Node { michael@0: [Throws] michael@0: readonly attribute DOMImplementation implementation; michael@0: [Pure] michael@0: readonly attribute DOMString URL; michael@0: [Pure] michael@0: readonly attribute DOMString documentURI; michael@0: [Pure] michael@0: readonly attribute DOMString compatMode; michael@0: [Pure] michael@0: readonly attribute DOMString characterSet; michael@0: [Pure] michael@0: readonly attribute DOMString contentType; michael@0: michael@0: [Pure] michael@0: readonly attribute DocumentType? doctype; michael@0: [Pure] michael@0: readonly attribute Element? documentElement; michael@0: [Pure] michael@0: HTMLCollection getElementsByTagName(DOMString localName); michael@0: [Pure, Throws] michael@0: HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); michael@0: [Pure] michael@0: HTMLCollection getElementsByClassName(DOMString classNames); michael@0: [Pure] michael@0: Element? getElementById(DOMString elementId); michael@0: michael@0: [NewObject, Throws] michael@0: Element createElement(DOMString localName); michael@0: [NewObject, Throws] michael@0: Element createElementNS(DOMString? namespace, DOMString qualifiedName); michael@0: [NewObject] michael@0: DocumentFragment createDocumentFragment(); michael@0: [NewObject] michael@0: Text createTextNode(DOMString data); michael@0: [NewObject] michael@0: Comment createComment(DOMString data); michael@0: [NewObject, Throws] michael@0: ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); michael@0: michael@0: [Throws] michael@0: Node importNode(Node node, optional boolean deep = false); michael@0: [Throws] michael@0: Node adoptNode(Node node); michael@0: michael@0: [NewObject, Throws] michael@0: Event createEvent(DOMString interface); michael@0: michael@0: [NewObject, Throws] michael@0: Range createRange(); michael@0: michael@0: // NodeFilter.SHOW_ALL = 0xFFFFFFFF michael@0: [NewObject, Throws] michael@0: NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); michael@0: [NewObject, Throws] michael@0: TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); michael@0: michael@0: // NEW michael@0: // No support for prepend/append yet michael@0: // void prepend((Node or DOMString)... nodes); michael@0: // void append((Node or DOMString)... nodes); michael@0: michael@0: // These are not in the spec, but leave them for now for backwards compat. michael@0: // So sort of like Gecko extensions michael@0: [NewObject, Throws] michael@0: CDATASection createCDATASection(DOMString data); michael@0: [NewObject, Throws] michael@0: Attr createAttribute(DOMString name); michael@0: [NewObject, Throws] michael@0: Attr createAttributeNS(DOMString? namespace, DOMString name); michael@0: [Pure] michael@0: readonly attribute DOMString? inputEncoding; michael@0: }; michael@0: michael@0: // http://www.whatwg.org/specs/web-apps/current-work/#the-document-object michael@0: partial interface Document { michael@0: [PutForwards=href, Unforgeable] readonly attribute Location? location; michael@0: //(HTML only) attribute DOMString domain; michael@0: readonly attribute DOMString referrer; michael@0: //(HTML only) attribute DOMString cookie; michael@0: readonly attribute DOMString lastModified; michael@0: readonly attribute DOMString readyState; michael@0: michael@0: // DOM tree accessors michael@0: //(Not proxy yet)getter object (DOMString name); michael@0: [SetterThrows, Pure] michael@0: attribute DOMString title; michael@0: [Pure] michael@0: attribute DOMString dir; michael@0: //(HTML only) attribute HTMLElement? body; michael@0: //(HTML only)readonly attribute HTMLHeadElement? head; michael@0: //(HTML only)readonly attribute HTMLCollection images; michael@0: //(HTML only)readonly attribute HTMLCollection embeds; michael@0: //(HTML only)readonly attribute HTMLCollection plugins; michael@0: //(HTML only)readonly attribute HTMLCollection links; michael@0: //(HTML only)readonly attribute HTMLCollection forms; michael@0: //(HTML only)readonly attribute HTMLCollection scripts; michael@0: //(HTML only)NodeList getElementsByName(DOMString elementName); michael@0: //(HTML only)NodeList getItems(optional DOMString typeNames); // microdata michael@0: //(Not implemented)readonly attribute DOMElementMap cssElementMap; michael@0: michael@0: // dynamic markup insertion michael@0: //(HTML only)Document open(optional DOMString type, optional DOMString replace); michael@0: //(HTML only)WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace); michael@0: //(HTML only)void close(); michael@0: //(HTML only)void write(DOMString... text); michael@0: //(HTML only)void writeln(DOMString... text); michael@0: michael@0: // user interaction michael@0: [Pure] michael@0: readonly attribute WindowProxy? defaultView; michael@0: readonly attribute Element? activeElement; michael@0: [Throws] michael@0: boolean hasFocus(); michael@0: //(HTML only) attribute DOMString designMode; michael@0: //(HTML only)boolean execCommand(DOMString commandId); michael@0: //(HTML only)boolean execCommand(DOMString commandId, boolean showUI); michael@0: //(HTML only)boolean execCommand(DOMString commandId, boolean showUI, DOMString value); michael@0: //(HTML only)boolean queryCommandEnabled(DOMString commandId); michael@0: //(HTML only)boolean queryCommandIndeterm(DOMString commandId); michael@0: //(HTML only)boolean queryCommandState(DOMString commandId); michael@0: //(HTML only)boolean queryCommandSupported(DOMString commandId); michael@0: //(HTML only)DOMString queryCommandValue(DOMString commandId); michael@0: //(Not implemented)readonly attribute HTMLCollection commands; michael@0: michael@0: // special event handler IDL attributes that only apply to Document objects michael@0: [LenientThis] attribute EventHandler onreadystatechange; michael@0: michael@0: // Gecko extensions? michael@0: attribute EventHandler onwheel; michael@0: attribute EventHandler oncopy; michael@0: attribute EventHandler oncut; michael@0: attribute EventHandler onpaste; michael@0: attribute EventHandler onbeforescriptexecute; michael@0: attribute EventHandler onafterscriptexecute; michael@0: /** michael@0: * True if this document is synthetic : stand alone image, video, audio file, michael@0: * etc. michael@0: */ michael@0: [Func="IsChromeOrXBL"] readonly attribute boolean mozSyntheticDocument; michael@0: /** michael@0: * Returns the script element whose script is currently being processed. michael@0: * michael@0: * @see michael@0: */ michael@0: [Pure] michael@0: readonly attribute Element? currentScript; michael@0: /** michael@0: * Release the current mouse capture if it is on an element within this michael@0: * document. michael@0: * michael@0: * @see michael@0: */ michael@0: void releaseCapture(); michael@0: /** michael@0: * Use the given DOM element as the source image of target |-moz-element()|. michael@0: * michael@0: * This function introduces a new special ID (called "image element ID"), michael@0: * which is only used by |-moz-element()|, and associates it with the given michael@0: * DOM element. Image elements ID's have the higher precedence than general michael@0: * HTML id's, so if |document.mozSetImageElement(, )| is called, michael@0: * |-moz-element(#)| uses || as the source image even if there michael@0: * is another element with id attribute = ||. To unregister an image michael@0: * element ID ||, call |document.mozSetImageElement(, null)|. michael@0: * michael@0: * Example: michael@0: * michael@0: *
michael@0: * michael@0: * @param aImageElementId an image element ID to associate with michael@0: * |aImageElement| michael@0: * @param aImageElement a DOM element to be used as the source image of michael@0: * |-moz-element(#aImageElementId)|. If this is null, the function will michael@0: * unregister the image element ID |aImageElementId|. michael@0: * michael@0: * @see michael@0: */ michael@0: void mozSetImageElement(DOMString aImageElementId, michael@0: Element? aImageElement); michael@0: michael@0: [ChromeOnly] michael@0: readonly attribute URI? documentURIObject; michael@0: michael@0: }; michael@0: michael@0: // http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api michael@0: partial interface Document { michael@0: // Note: Per spec the 'S' in these two is lowercase, but the "Moz" michael@0: // versions hve it uppercase. michael@0: readonly attribute boolean mozFullScreenEnabled; michael@0: [Throws] michael@0: readonly attribute Element? mozFullScreenElement; michael@0: michael@0: //(Renamed?)void exitFullscreen(); michael@0: michael@0: // Gecko-specific fullscreen bits michael@0: readonly attribute boolean mozFullScreen; michael@0: void mozCancelFullScreen(); michael@0: }; michael@0: michael@0: // http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface michael@0: partial interface Document { michael@0: readonly attribute Element? mozPointerLockElement; michael@0: void mozExitPointerLock (); michael@0: }; michael@0: michael@0: //http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register michael@0: partial interface Document { michael@0: [Throws, Func="nsDocument::IsRegisterElementEnabled"] michael@0: object registerElement(DOMString name, optional ElementRegistrationOptions options); michael@0: }; michael@0: michael@0: //http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register michael@0: partial interface Document { michael@0: [NewObject, Throws] michael@0: Element createElement(DOMString localName, DOMString typeExtension); michael@0: [NewObject, Throws] michael@0: Element createElementNS(DOMString? namespace, DOMString qualifiedName, DOMString typeExtension); michael@0: }; michael@0: michael@0: // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface michael@0: partial interface Document { michael@0: readonly attribute boolean hidden; michael@0: readonly attribute boolean mozHidden; michael@0: readonly attribute VisibilityState visibilityState; michael@0: readonly attribute VisibilityState mozVisibilityState; michael@0: }; michael@0: michael@0: // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface michael@0: partial interface Document { michael@0: [Constant] michael@0: readonly attribute StyleSheetList styleSheets; michael@0: attribute DOMString? selectedStyleSheetSet; michael@0: readonly attribute DOMString? lastStyleSheetSet; michael@0: readonly attribute DOMString? preferredStyleSheetSet; michael@0: [Constant] michael@0: readonly attribute DOMStringList styleSheetSets; michael@0: void enableStyleSheetsForSet (DOMString? name); michael@0: }; michael@0: michael@0: // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface michael@0: partial interface Document { michael@0: Element? elementFromPoint (float x, float y); michael@0: michael@0: CaretPosition? caretPositionFromPoint (float x, float y); michael@0: }; michael@0: michael@0: // http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html michael@0: partial interface Document { michael@0: [Pref="dom.undo_manager.enabled"] michael@0: readonly attribute UndoManager? undoManager; michael@0: }; michael@0: michael@0: // http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions michael@0: partial interface Document { michael@0: [Throws, Pure] michael@0: Element? querySelector(DOMString selectors); michael@0: [Throws, Pure] michael@0: NodeList querySelectorAll(DOMString selectors); michael@0: michael@0: //(Not implemented)Element? find(DOMString selectors, optional (Element or sequence)? refNodes); michael@0: //(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence)? refNodes); michael@0: }; michael@0: michael@0: // Mozilla extensions of various sorts michael@0: partial interface Document { michael@0: // nsIDOMDocumentXBL. Wish we could make these [ChromeOnly], but michael@0: // that would likely break bindings running with the page principal. michael@0: [Func="IsChromeOrXBL"] michael@0: NodeList? getAnonymousNodes(Element elt); michael@0: [Func="IsChromeOrXBL"] michael@0: Element? getAnonymousElementByAttribute(Element elt, DOMString attrName, michael@0: DOMString attrValue); michael@0: [Func="IsChromeOrXBL"] michael@0: Element? getBindingParent(Node node); michael@0: [Throws, Func="IsChromeOrXBL"] michael@0: void loadBindingDocument(DOMString documentURL); michael@0: michael@0: // nsIDOMDocumentTouch michael@0: // XXXbz I can't find the sane spec for this stuff, so just cribbing michael@0: // from our xpidl for now. michael@0: [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] michael@0: Touch createTouch(optional Window? view = null, michael@0: optional EventTarget? target = null, michael@0: optional long identifier = 0, michael@0: optional long pageX = 0, michael@0: optional long pageY = 0, michael@0: optional long screenX = 0, michael@0: optional long screenY = 0, michael@0: optional long clientX = 0, michael@0: optional long clientY = 0, michael@0: optional long radiusX = 0, michael@0: optional long radiusY = 0, michael@0: optional float rotationAngle = 0, michael@0: optional float force = 0); michael@0: // XXXbz a hack to get around the fact that we don't support variadics as michael@0: // distinguishing arguments yet. Once this hack is removed. we can also michael@0: // remove the corresponding overload on nsIDocument, since Touch... and michael@0: // sequence look the same in the C++. michael@0: [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] michael@0: TouchList createTouchList(Touch touch, Touch... touches); michael@0: // XXXbz and another hack for the fact that we can't usefully have optional michael@0: // distinguishing arguments but need a working zero-arg form of michael@0: // createTouchList(). michael@0: [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] michael@0: TouchList createTouchList(); michael@0: [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"] michael@0: TouchList createTouchList(sequence touches); michael@0: michael@0: [ChromeOnly] michael@0: attribute boolean styleSheetChangeEventsEnabled; michael@0: michael@0: [ChromeOnly, Throws] michael@0: void obsoleteSheet(URI sheetURI); michael@0: [ChromeOnly, Throws] michael@0: void obsoleteSheet(DOMString sheetURI); michael@0: michael@0: [ChromeOnly] readonly attribute nsIDocShell? docShell; michael@0: michael@0: [ChromeOnly] readonly attribute DOMString contentLanguage; michael@0: }; michael@0: michael@0: // Extension to give chrome JS the ability to determine when a document was michael@0: // created to satisfy an iframe with srcdoc attribute. michael@0: partial interface Document { michael@0: [ChromeOnly] readonly attribute boolean isSrcdocDocument; michael@0: }; michael@0: michael@0: Document implements XPathEvaluator; michael@0: Document implements GlobalEventHandlers; michael@0: Document implements TouchEventHandlers; michael@0: Document implements ParentNode; michael@0: Document implements OnErrorEventHandlerForNodes;