JavaScript is disabled on your browser.
Skip navigation links
org.htmlunit.javascript.host.html

Class HTMLDocument

    • Constructor Detail

      • HTMLDocument

        public HTMLDocument()
    • Method Detail

      • jsConstructor

        public void jsConstructor()
        JavaScript constructor.
        Overrides:
        jsConstructor in class Document
      • getDomNodeOrDie

        public DomNode getDomNodeOrDie()
        Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.
        Overrides:
        getDomNodeOrDie in class HtmlUnitScriptable
        Returns:
        the DOM node
      • getPage

        public HtmlPage getPage()
        Returns the HTML page that this document is modeling.
        Overrides:
        getPage in class Document
        Returns:
        the HTML page that this document is modeling
      • setExecutingDynamicExternalPosponed

        public void setExecutingDynamicExternalPosponed(boolean executing)
        This a hack!!! A cleaner way is welcome. Handle a case where document.write is simply ignored. See HTMLDocumentWrite2Test.write_fromScriptAddedWithAppendChild_external.
        Parameters:
        executing - indicates if executing or not
      • write

        protected void write(String content)
        JavaScript function "write".

        See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for a good description of the semantics of open(), write(), writeln() and close().

        Parameters:
        content - the content to write
      • open

        public HTMLDocument open(Object url,
         Object name,
         Object features,
         Object replace)
        JavaScript function "open".

        See http://www.whatwg.org/specs/web-apps/current-work/multipage/section-dynamic.html for a good description of the semantics of open(), write(), writeln() and close().

        Parameters:
        url - when a new document is opened, url is a String that specifies a MIME type for the document. When a new window is opened, url is a String that specifies the URL to render in the new window
        name - the name
        features - the features
        replace - whether to replace in the history list or no
        Returns:
        a reference to the new document object.
        See Also:
        MSDN documentation
      • getDocumentElement

        public Element getDocumentElement()
        Gets the JavaScript property documentElement for the document.
        Overrides:
        getDocumentElement in class Document
        Returns:
        the root node for the document
      • appendChild

        public Node appendChild(Object childObject)
        Adds a DOM node to the node.
        Overrides:
        appendChild in class Node
        Parameters:
        childObject - the node to add to this node
        Returns:
        the newly added child node
      • getElementById

        public HtmlUnitScriptable getElementById(String id)
        Returns the element with the specified ID, or null if that element could not be found.
        Overrides:
        getElementById in class Document
        Parameters:
        id - the ID to search for
        Returns:
        the element, or null if it could not be found
      • getElementsByClassName

        public HTMLCollection getElementsByClassName(String className)
        Returns all the descendant elements with the specified class name.
        Overrides:
        getElementsByClassName in class Document
        Parameters:
        className - the name to search for
        Returns:
        all the descendant elements with the specified class name
        See Also:
        Mozilla doc
      • getElementsByName

        public NodeList getElementsByName(String elementName)
        Returns all HTML elements that have a name attribute with the specified value.

        Refer to The DOM spec for details.

        Overrides:
        getElementsByName in class Document
        Parameters:
        elementName - - value of the name attribute to look for
        Returns:
        all HTML elements that have a name attribute with the specified value
      • getWithPreemption

        protected Object getWithPreemption(String name)
        Calls to document.XYZ should first look at elements named XYZ before using standard functions.

        Called by HtmlUnitScriptable.get(String, Scriptable) to allow retrieval of the property before the prototype chain is searched.

        IMPORTANT: This method is invoked *very* often by Rhino. If you override this method, the implementation needs to be as fast as possible!

        Overrides:
        getWithPreemption in class HtmlUnitScriptable
        Parameters:
        name - the property name
        Returns:
        Scriptable.NOT_FOUND if not found
      • getHead

        public HTMLElement getHead()
        Returns this document's head element.
        Overrides:
        getHead in class Document
        Returns:
        this document's head element
      • getTitle

        public String getTitle()
        Returns this document's title.
        Overrides:
        getTitle in class Document
        Returns:
        this document's title
      • setTitle

        public void setTitle(String title)
        Sets this document's title.
        Overrides:
        setTitle in class Document
        Parameters:
        title - the new title
      • hasFocus

        public boolean hasFocus()
        Returns false if the active element in the document has no focus; true if the active element in the document has focus.
        Overrides:
        hasFocus in class Document
        Returns:
        whether the active element in the document has focus or not
      • dispatchEvent

        public boolean dispatchEvent(Event event)
        Dispatches an event into the event system (standards-conformant browsers only). See the Gecko DOM reference for more information.
        Overrides:
        dispatchEvent in class EventTarget
        Parameters:
        event - the event to be dispatched
        Returns:
        false if at least one of the event handlers which handled the event called preventDefault; true otherwise
      • getSelection

        public Selection getSelection()
        Returns the current selection.
        Overrides:
        getSelection in class Document
        Returns:
        the current selection
      • createAttribute

        public Attr createAttribute(String attributeName)
        Creates a new HTML attribute with the specified name.
        Overrides:
        createAttribute in class Document
        Parameters:
        attributeName - the name of the attribute to create
        Returns:
        an attribute with the specified name
      • getBaseURI

        public String getBaseURI()
        Returns the Base URI as a string.
        Overrides:
        getBaseURI in class Node
        Returns:
        the Base URI as a string
      • elementFromPoint

        public HtmlUnitScriptable elementFromPoint(int x,
         int y)
        Returns the element for the specified x coordinate and the specified y coordinate. The current implementation always returns null element.
        Overrides:
        elementFromPoint in class Document
        Parameters:
        x - the x offset, in pixels
        y - the y offset, in pixels
        Returns:
        the element for the specified x coordinate and the specified y coordinate
Skip navigation links

Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /