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

Class Node

    • Constructor Detail

      • Node

        public Node()
    • Method Detail

      • getNodeType

        public int getNodeType()
        Gets the JavaScript property nodeType for the current node.
        Returns:
        the node type
      • getNodeName

        public String getNodeName()
        Gets the JavaScript property nodeName for the current node.
        Returns:
        the node name
      • getNodeValue

        public String getNodeValue()
        Gets the JavaScript property nodeValue for the current node.
        Returns:
        the node value
      • setNodeValue

        public void setNodeValue(String newValue)
        Sets the JavaScript property nodeValue for the current node.
        Parameters:
        newValue - the new node value
      • appendChild

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

        protected Node insertBeforeImpl(Object[] args)
        Add a DOM node as a child to this node before the referenced node. If the referenced node is null, append to the end.
        Parameters:
        args - the arguments
        Returns:
        the newly added child node
      • remove

        protected void remove()
        Removes the DOM node from its parent.
        See Also:
        MDN documentation
      • removeChild

        public Node removeChild(Object childObject)
        Removes a DOM node from this node.
        Parameters:
        childObject - the node to remove from this node
        Returns:
        the removed child node
      • replaceChild

        public Node replaceChild(Object newChildObject,
         Object oldChildObject)
        Replaces a child DOM node with another DOM node.
        Parameters:
        newChildObject - the node to add as a child of this node
        oldChildObject - the node to remove as a child of this node
        Returns:
        the removed child node
      • cloneNode

        public Node cloneNode(boolean deep)
        Clones this node.
        Parameters:
        deep - if true, recursively clones all descendants
        Returns:
        the newly cloned node
      • isEqualNode

        public boolean isEqualNode(Node other)
        Check if 2 nodes are equals. For detail specifications
        Parameters:
        other - the node to compare with
        Returns:
        true or false
        See Also:
        concept-node-equals
      • isSameNode

        public boolean isSameNode(Object other)
        This method provides a way to determine whether two Node references returned by the implementation reference the same object. When two Node references are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.
        Parameters:
        other - the node to test against
        Returns:
        whether this node is the same node as the given one
      • hasChildNodes

        public boolean hasChildNodes()
        Returns whether this node has any children.
        Returns:
        boolean true if this node has any children, false otherwise
      • lookupPrefix

        public String lookupPrefix(String namespace)
        Parameters:
        namespace - string containing the namespace to look the prefix up
        Returns:
        a string containing the prefix for a given namespace URI, if present, and null if not. When multiple prefixes are possible, the first prefix is returned.
      • getChildNodes

        public NodeList getChildNodes()
        Returns the child nodes of the current element.
        Returns:
        the child nodes of the current element
      • getParent

        public final Node getParent()
        Returns this node's parent node.
        Returns:
        this node's parent node
      • getParentNode

        public Object getParentNode()
        Gets the JavaScript property parentNode for the node that contains the current node.
        Returns:
        the parent node
      • getNextSibling

        public Node getNextSibling()
        Gets the JavaScript property nextSibling for the node that contains the current node.
        Returns:
        the next sibling node or null if the current node has no next sibling.
      • getPreviousSibling

        public Node getPreviousSibling()
        Gets the JavaScript property previousSibling for the node that contains the current node.
        Returns:
        the previous sibling node or null if the current node has no previous sibling.
      • getFirstChild

        public Node getFirstChild()
        Gets the JavaScript property firstChild for the node that contains the current node.
        Returns:
        the first child node or null if the current node has no children.
      • getLastChild

        public Node getLastChild()
        Gets the JavaScript property lastChild for the node that contains the current node.
        Returns:
        the last child node or null if the current node has no children.
      • getJavaScriptNode

        protected Node getJavaScriptNode(DomNode domNode)
        Gets the JavaScript node for a given DomNode.
        Parameters:
        domNode - the DomNode
        Returns:
        the JavaScript node or null if the DomNode was null
      • getOwnerDocument

        public HtmlUnitScriptable getOwnerDocument()
        Returns the owner document.
        Returns:
        the document
      • getRootNode

        public Node getRootNode()
        Returns the owner document.
        Returns:
        the document
      • compareDocumentPosition

        public int compareDocumentPosition(Object node)
        Compares the positions of this node and the provided node within the document.
        Parameters:
        node - node object that specifies the node to check
        Returns:
        how the node is positioned relatively to the reference node.
        See Also:
        DOM level 3, Node.compareDocumentPosition(org.w3c.dom.Node)
      • normalize

        public void normalize()
        Merges adjacent TextNode objects to produce a normalized document object model.
      • getTextContent

        public String getTextContent()
        Gets the textContent attribute.
        Returns:
        the contents of this node as text
      • setTextContent

        public void setTextContent(Object value)
        Replace all children elements of this element with the supplied value.
        Parameters:
        value - - the new value for the contents of this node
      • getParentElement

        public Element getParentElement()
        Gets the JavaScript property parentElement.
        Returns:
        the parent element
        See Also:
        getParentNode()
      • getAttributes

        public NamedNodeMap getAttributes()
        Returns the attributes of this XML element.
        Returns:
        the attributes of this XML element
        See Also:
        Gecko DOM Reference
      • contains

        public boolean contains(Object element)
        Checks whether the given element is contained within this object.
        Parameters:
        element - element object that specifies the element to check
        Returns:
        true if the element is contained within this object
      • getBaseURI

        public String getBaseURI()
        Returns the Base URI as a string.
        Returns:
        the Base URI as a string
      • hasAttributes

        public boolean hasAttributes()
        Returns true when the current element has any attributes or not.
        Returns:
        true if an attribute is specified on this element
      • getPrefix

        public String getPrefix()
        Returns the namespace prefix.
        Returns:
        the namespace prefix
      • getLocalName

        public String getLocalName()
        Returns the local name of this attribute.
        Returns:
        the local name of this attribute
      • getNamespaceURI

        public String getNamespaceURI()
        Returns the URI that identifies an XML namespace.
        Returns:
        the URI that identifies an XML namespace
      • getChildElementCount

        protected int getChildElementCount()
        Returns the current number of child elements.
        Returns:
        the child element count
      • getFirstElementChild

        protected Element getFirstElementChild()
        Returns the first element child.
        Returns:
        the first element child
      • getLastElementChild

        protected Element getLastElementChild()
        Returns the last element child.
        Returns:
        the last element child
      • getChildren

        protected HTMLCollection getChildren()
        Gets the children of the current node.
        Returns:
        the child at the given position
        See Also:
        MSDN documentation
Skip navigation links

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

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