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 michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIDOMNode.idl" michael@0: michael@0: %{ C++ michael@0: #include "jspubtd.h" michael@0: michael@0: // windows.h #defines CreateEvent michael@0: #ifdef CreateEvent michael@0: #undef CreateEvent michael@0: #endif michael@0: %} michael@0: michael@0: interface nsIDOMNodeIterator; michael@0: interface nsIDOMNodeFilter; michael@0: interface nsIDOMTreeWalker; michael@0: interface nsIDOMLocation; michael@0: michael@0: /** michael@0: * The nsIDOMDocument interface represents the entire HTML or XML document. michael@0: * Conceptually, it is the root of the document tree, and provides the michael@0: * primary access to the document's data. michael@0: * Since elements, text nodes, comments, processing instructions, etc. michael@0: * cannot exist outside the context of a Document, the nsIDOMDocument michael@0: * interface also contains the factory methods needed to create these michael@0: * objects. michael@0: * michael@0: * For more information on this interface please see michael@0: * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html michael@0: */ michael@0: michael@0: [scriptable, uuid(d24d1118-a527-4d5a-9c4e-fb07dfc2fc27)] michael@0: interface nsIDOMDocument : nsIDOMNode michael@0: { michael@0: readonly attribute nsIDOMDocumentType doctype; michael@0: readonly attribute nsIDOMDOMImplementation implementation; michael@0: readonly attribute nsIDOMElement documentElement; michael@0: nsIDOMElement createElement([Null(Stringify)] in DOMString tagName) michael@0: raises(DOMException); michael@0: nsIDOMDocumentFragment createDocumentFragment(); michael@0: nsIDOMText createTextNode(in DOMString data); michael@0: nsIDOMComment createComment(in DOMString data); michael@0: nsIDOMCDATASection createCDATASection(in DOMString data) michael@0: raises(DOMException); michael@0: nsIDOMProcessingInstruction createProcessingInstruction(in DOMString target, michael@0: in DOMString data) michael@0: raises(DOMException); michael@0: nsIDOMAttr createAttribute(in DOMString name) michael@0: raises(DOMException); michael@0: nsIDOMNodeList getElementsByTagName(in DOMString tagname); michael@0: michael@0: // Introduced in DOM Level 2: michael@0: [optional_argc] nsIDOMNode importNode(in nsIDOMNode importedNode, michael@0: [optional] in boolean deep) michael@0: raises(DOMException); michael@0: // Introduced in DOM Level 2: michael@0: nsIDOMElement createElementNS(in DOMString namespaceURI, michael@0: [Null(Stringify)] in DOMString qualifiedName) michael@0: raises(DOMException); michael@0: // Introduced in DOM Level 2: michael@0: nsIDOMAttr createAttributeNS(in DOMString namespaceURI, michael@0: in DOMString qualifiedName) michael@0: raises(DOMException); michael@0: // Introduced in DOM Level 2: michael@0: nsIDOMNodeList getElementsByTagNameNS(in DOMString namespaceURI, michael@0: in DOMString localName); michael@0: // Introduced in DOM Level 2: michael@0: nsIDOMElement getElementById(in DOMString elementId); michael@0: // Introduced in DOM Level 3: michael@0: readonly attribute DOMString inputEncoding; michael@0: // Introduced in DOM Level 3: michael@0: readonly attribute DOMString documentURI; michael@0: // Alias introduced for all documents in recent DOM standards michael@0: readonly attribute DOMString URL; michael@0: // Introduced in DOM Level 3: michael@0: nsIDOMNode adoptNode(in nsIDOMNode source) michael@0: raises(DOMException); michael@0: michael@0: /** michael@0: * Create a range michael@0: * michael@0: * @see http://html5.org/specs/dom-range.html#dom-document-createrange michael@0: */ michael@0: nsIDOMRange createRange(); michael@0: michael@0: [optional_argc] nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, michael@0: [optional] in unsigned long whatToShow, michael@0: [optional] in nsIDOMNodeFilter filter) michael@0: raises(DOMException); michael@0: [optional_argc] nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, michael@0: [optional] in unsigned long whatToShow, michael@0: [optional] in nsIDOMNodeFilter filter) michael@0: raises(DOMException); michael@0: michael@0: nsIDOMEvent createEvent(in DOMString eventType) michael@0: raises(DOMException); michael@0: michael@0: michael@0: // HTML michael@0: /** michael@0: * The window associated with this document. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMWindow defaultView; michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString characterSet; michael@0: /** michael@0: * @see michael@0: */ michael@0: attribute DOMString dir; michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMLocation location; michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: attribute DOMString title; michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString readyState; michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString lastModified; michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString referrer; michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: boolean hasFocus(); michael@0: michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMElement activeElement; michael@0: michael@0: /** michael@0: * Retrieve elements matching all classes listed in a michael@0: * space-separated string. michael@0: * michael@0: * @see michael@0: */ michael@0: nsIDOMNodeList getElementsByClassName(in DOMString classes); michael@0: michael@0: michael@0: // CSSOM michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMStyleSheetList styleSheets; michael@0: michael@0: /** michael@0: * This attribute must return the preferred style sheet set as set by the michael@0: * author. It is determined from the order of style sheet declarations and michael@0: * the Default-Style HTTP headers, as eventually defined elsewhere in the Web michael@0: * Apps 1.0 specification. If there is no preferred style sheet set, this michael@0: * attribute must return the empty string. The case of this attribute must michael@0: * exactly match the case given by the author where the preferred style sheet michael@0: * is specified or implied. This attribute must never return null. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString preferredStyleSheetSet; michael@0: michael@0: /** michael@0: * This attribute indicates which style sheet set is in use. This attribute michael@0: * is live; changing the disabled attribute on style sheets directly will michael@0: * change the value of this attribute. michael@0: * michael@0: * If all the sheets that are enabled and have a title have the same title michael@0: * (by case-sensitive comparisons) then the value of this attribute must be michael@0: * exactly equal to the title of the first enabled style sheet with a title michael@0: * in the styleSheets list. Otherwise, if style sheets from different sets michael@0: * are enabled, then the return value must be null (there is no way to michael@0: * determine what the currently selected style sheet set is in those michael@0: * conditions). Otherwise, either all style sheets that have a title are michael@0: * disabled, or there are no alternate style sheets, and michael@0: * selectedStyleSheetSet must return the empty string. michael@0: * michael@0: * Setting this attribute to the null value must have no effect. michael@0: * michael@0: * Setting this attribute to a non-null value must call michael@0: * enableStyleSheetsForSet() with that value as the function's argument, and michael@0: * set lastStyleSheetSet to that value. michael@0: * michael@0: * From the DOM's perspective, all views have the same michael@0: * selectedStyleSheetSet. If a UA supports multiple views with different michael@0: * selected alternate style sheets, then this attribute (and the StyleSheet michael@0: * interface's disabled attribute) must return and set the value for the michael@0: * default view. michael@0: * michael@0: * @see michael@0: */ michael@0: [binaryname(MozSelectedStyleSheetSet)] michael@0: attribute DOMString selectedStyleSheetSet; michael@0: michael@0: /* michael@0: * This property must initially have the value null. Its value changes when michael@0: * the selectedStyleSheetSet attribute is set. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString lastStyleSheetSet; michael@0: michael@0: /** michael@0: * This must return the live list of the currently available style sheet michael@0: * sets. This list is constructed by enumerating all the style sheets for michael@0: * this document available to the implementation, in the order they are michael@0: * listed in the styleSheets attribute, adding the title of each style sheet michael@0: * with a title to the list, avoiding duplicates by dropping titles that michael@0: * match (case-sensitively) titles that have already been added to the michael@0: * list. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute nsISupports styleSheetSets; michael@0: michael@0: /** michael@0: * Calling this method must change the disabled attribute on each StyleSheet michael@0: * object with a title attribute with a length greater than 0 in the michael@0: * styleSheets attribute, so that all those whose title matches the name michael@0: * argument are enabled, and all others are disabled. Title matches must be michael@0: * case-sensitive. Calling this method with the empty string disables all michael@0: * alternate and preferred style sheets (but does not change the state of michael@0: * persistent style sheets, that is those with no title attribute). michael@0: * michael@0: * Calling this method with a null value must have no effect. michael@0: * michael@0: * Style sheets that do not have a title are never affected by this michael@0: * method. This method does not change the values of the lastStyleSheetSet or michael@0: * preferredStyleSheetSet attributes. michael@0: * michael@0: * @see michael@0: */ michael@0: [binaryname(MozEnableStyleSheetsForSet)] michael@0: void enableStyleSheetsForSet(in DOMString name); michael@0: michael@0: michael@0: // CSSOM-View michael@0: /** michael@0: * Returns the element from the caller's document at the given point, michael@0: * relative to the upper-left-most point in the (possibly scrolled) michael@0: * window or frame. michael@0: * michael@0: * If the element at the given point belongs to another document (such as michael@0: * an iframe's subdocument), the element in the calling document's DOM michael@0: * (e.g. the iframe) is returned. If the element at the given point is michael@0: * anonymous or XBL generated content, such as a textbox's scrollbars, then michael@0: * the first non-anonymous parent element (that is, the textbox) is returned. michael@0: * michael@0: * This method returns null if either coordinate is negative, or if the michael@0: * specified point lies outside the visible bounds of the document. michael@0: * michael@0: * Callers from XUL documents should wait until the onload event has fired michael@0: * before calling this method. michael@0: * michael@0: * @see michael@0: */ michael@0: nsIDOMElement elementFromPoint(in float x, in float y); michael@0: michael@0: michael@0: // Mozilla extensions michael@0: /** michael@0: * @see michael@0: */ michael@0: readonly attribute DOMString contentType; michael@0: michael@0: /** michael@0: * True if this document is synthetic : stand alone image, video, audio file, michael@0: * etc. michael@0: */ michael@0: readonly attribute boolean mozSyntheticDocument; michael@0: michael@0: /** michael@0: * Returns the script element whose script is currently being processed. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMElement currentScript; michael@0: 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: /** 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(in DOMString aImageElementId, michael@0: in nsIDOMElement aImageElement); michael@0: michael@0: /** michael@0: * Element which is currently the full-screen element as per the DOM michael@0: * full-screen api. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMElement mozFullScreenElement; michael@0: michael@0: /** michael@0: * Causes the document to leave DOM full-screen mode, if it's in michael@0: * full-screen mode, as per the DOM full-screen api. michael@0: * michael@0: * @see michael@0: */ michael@0: void mozCancelFullScreen(); michael@0: michael@0: /** michael@0: * Denotes whether this document is in DOM full-screen mode, as per the DOM michael@0: * full-screen api. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute boolean mozFullScreen; michael@0: michael@0: /** michael@0: * Denotes whether the full-screen-api.enabled is true, no windowed michael@0: * plugins are present, and all ancestor documents have the michael@0: * allowfullscreen attribute set. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute boolean mozFullScreenEnabled; michael@0: michael@0: /** michael@0: * The element to which the mouse pointer is locked, if any, as per the michael@0: * DOM pointer lock api. michael@0: * michael@0: * @see michael@0: */ michael@0: readonly attribute nsIDOMElement mozPointerLockElement; michael@0: michael@0: /** michael@0: * Retrieve the location of the caret position (DOM node and character michael@0: * offset within that node), given a point. michael@0: * michael@0: * @param x Horizontal point at which to determine the caret position, in michael@0: * page coordinates. michael@0: * @param y Vertical point at which to determine the caret position, in michael@0: * page coordinates. michael@0: */ michael@0: nsISupports /* CaretPosition */ caretPositionFromPoint(in float x, in float y); michael@0: michael@0: /** michael@0: * Exit pointer is lock if locked, as per the DOM pointer lock api. michael@0: * michael@0: * @see michael@0: */ michael@0: void mozExitPointerLock(); michael@0: michael@0: /** michael@0: * Visibility API implementation. michael@0: */ michael@0: readonly attribute boolean hidden; michael@0: readonly attribute boolean mozHidden; michael@0: readonly attribute DOMString visibilityState; michael@0: readonly attribute DOMString mozVisibilityState; michael@0: michael@0: /** michael@0: * Returns "BackCompat" if we're in quirks mode or "CSS1Compat" if we're in michael@0: * strict mode. (XML documents are always in strict mode.) michael@0: */ michael@0: readonly attribute DOMString compatMode; michael@0: michael@0: /** michael@0: * Return nodes that match a given CSS selector. michael@0: * michael@0: * @see michael@0: */ michael@0: nsIDOMElement querySelector([Null(Stringify)] in DOMString selectors); michael@0: nsIDOMNodeList querySelectorAll([Null(Stringify)] in DOMString selectors); michael@0: };