Document.idl   [plain text]


/*
 * Copyright (C) 2006, 2007, 2011, 2015 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.
 */

[
    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;

#