public class Node extends EventTarget
Node
which is the base class for all DOM
objects. This will typically wrap an instance of DomNode
.org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
Modifier and Type | Field and Description |
---|---|
static int |
ATTRIBUTE_NODE |
static int |
CDATA_SECTION_NODE |
static int |
COMMENT_NODE |
static int |
DOCUMENT_FRAGMENT_NODE |
static int |
DOCUMENT_NODE |
static int |
DOCUMENT_POSITION_CONTAINED_BY |
static int |
DOCUMENT_POSITION_CONTAINS |
static int |
DOCUMENT_POSITION_DISCONNECTED |
static int |
DOCUMENT_POSITION_FOLLOWING |
static int |
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
static int |
DOCUMENT_POSITION_PRECEDING |
static int |
DOCUMENT_TYPE_NODE |
static int |
ELEMENT_NODE |
static int |
ENTITY_NODE |
static int |
ENTITY_REFERENCE_NODE |
static int |
NOTATION_NODE |
static int |
PROCESSING_INSTRUCTION_NODE |
static int |
TEXT_NODE |
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
Node() |
Modifier and Type | Method and Description |
---|---|
protected static void |
after(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent,
just after this ChildNode.
|
protected static void |
append(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Inserts a set of Node objects or string objects after the last child of the Element.
|
Node |
appendChild(Object childObject)
Adds a DOM node to the node.
|
protected static void |
before(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent,
just before this ChildNode.
|
Node |
cloneNode(boolean deep)
Clones this node.
|
int |
compareDocumentPosition(Object node)
Compares the positions of this node and the provided node within the document.
|
boolean |
contains(Object element)
Checks whether the given element is contained within this object.
|
NamedNodeMap |
getAttributes()
Returns the attributes of this XML element.
|
String |
getBaseURI()
Returns the Base URI as a string.
|
protected int |
getChildElementCount()
Returns the current number of child elements.
|
NodeList |
getChildNodes()
Returns the child nodes of the current element.
|
protected HTMLCollection |
getChildren()
Gets the children of the current node.
|
Node |
getFirstChild()
Gets the JavaScript property
firstChild for the node that
contains the current node. |
protected Element |
getFirstElementChild()
Returns the first element child.
|
protected Node |
getJavaScriptNode(DomNode domNode)
Gets the JavaScript node for a given DomNode.
|
Node |
getLastChild()
Gets the JavaScript property
lastChild for the node that
contains the current node. |
protected Element |
getLastElementChild()
Returns the last element child.
|
String |
getLocalName()
Returns the local name of this attribute.
|
String |
getNamespaceURI()
Returns the URI that identifies an XML namespace.
|
Node |
getNextSibling()
Gets the JavaScript property
nextSibling for the node that
contains the current node. |
String |
getNodeName()
Gets the JavaScript property
nodeName for the current node. |
int |
getNodeType()
Gets the JavaScript property
nodeType for the current node. |
String |
getNodeValue()
Gets the JavaScript property
nodeValue for the current node. |
HtmlUnitScriptable |
getOwnerDocument()
Returns the owner document.
|
Node |
getParent()
Returns this node's parent node.
|
Element |
getParentElement()
Gets the JavaScript property
parentElement . |
Object |
getParentNode()
Gets the JavaScript property
parentNode for the node that
contains the current node. |
String |
getPrefix()
Returns the namespace prefix.
|
Node |
getPreviousSibling()
Gets the JavaScript property
previousSibling for the node that
contains the current node. |
Node |
getRootNode()
Returns the owner document.
|
String |
getTextContent()
Gets the textContent attribute.
|
boolean |
hasAttributes()
Returns true when the current element has any attributes or not.
|
boolean |
hasChildNodes()
Returns whether this node has any children.
|
static Node |
insertBefore(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable scope,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Add a DOM node as a child to this node before the referenced node.
|
protected Node |
insertBeforeImpl(Object[] args)
Add a DOM node as a child to this node before the referenced node.
|
boolean |
isEqualNode(Node other)
Check if 2 nodes are equals.
|
boolean |
isSameNode(Object other)
This method provides a way to determine whether two Node references returned by
the implementation reference the same object.
|
void |
jsConstructor()
JavaScript constructor.
|
String |
lookupPrefix(String namespace) |
void |
normalize()
Merges adjacent TextNode objects to produce a normalized document object model.
|
protected static void |
prepend(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Inserts a set of Node objects or string objects before the first child of the Element.
|
protected void |
remove()
Removes the DOM node from its parent.
|
Node |
removeChild(Object childObject)
Removes a DOM node from this node.
|
Node |
replaceChild(Object newChildObject,
Object oldChildObject)
Replaces a child DOM node with another DOM node.
|
protected static void |
replaceChildren(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Replaces the existing children of a Node with a specified new set of children.
|
protected static void |
replaceWith(org.htmlunit.corejs.javascript.Context context,
org.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
org.htmlunit.corejs.javascript.Function function)
Replaces this ChildNode in the children list of its parent with a set of Node or DOMString objects.
|
void |
setNodeValue(String newValue)
Sets the JavaScript property
nodeValue for the current node. |
void |
setTextContent(Object value)
Replace all children elements of this element with the supplied value.
|
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final int ELEMENT_NODE
Node.ELEMENT_NODE
,
Constant Field Valuespublic static final int ATTRIBUTE_NODE
Node.ATTRIBUTE_NODE
,
Constant Field Valuespublic static final int TEXT_NODE
Node.TEXT_NODE
,
Constant Field Valuespublic static final int CDATA_SECTION_NODE
Node.CDATA_SECTION_NODE
,
Constant Field Valuespublic static final int ENTITY_REFERENCE_NODE
Node.ENTITY_REFERENCE_NODE
,
Constant Field Valuespublic static final int ENTITY_NODE
Node.ENTITY_NODE
,
Constant Field Valuespublic static final int PROCESSING_INSTRUCTION_NODE
public static final int COMMENT_NODE
Node.COMMENT_NODE
,
Constant Field Valuespublic static final int DOCUMENT_NODE
Node.DOCUMENT_NODE
,
Constant Field Valuespublic static final int DOCUMENT_TYPE_NODE
Node.DOCUMENT_TYPE_NODE
,
Constant Field Valuespublic static final int DOCUMENT_FRAGMENT_NODE
Node.DOCUMENT_FRAGMENT_NODE
,
Constant Field Valuespublic static final int NOTATION_NODE
Node.NOTATION_NODE
,
Constant Field Valuespublic static final int DOCUMENT_POSITION_DISCONNECTED
public static final int DOCUMENT_POSITION_PRECEDING
public static final int DOCUMENT_POSITION_FOLLOWING
public static final int DOCUMENT_POSITION_CONTAINS
public static final int DOCUMENT_POSITION_CONTAINED_BY
public static final int DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
public void jsConstructor()
jsConstructor
in class EventTarget
public int getNodeType()
nodeType
for the current node.public String getNodeName()
nodeName
for the current node.public String getNodeValue()
nodeValue
for the current node.public void setNodeValue(String newValue)
nodeValue
for the current node.newValue
- the new node valuepublic Node appendChild(Object childObject)
childObject
- the node to add to this nodepublic static Node insertBefore(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the JavaScript contextscope
- the scopethisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the functionprotected Node insertBeforeImpl(Object[] args)
args
- the argumentsprotected void remove()
public Node removeChild(Object childObject)
childObject
- the node to remove from this nodepublic Node replaceChild(Object newChildObject, Object oldChildObject)
newChildObject
- the node to add as a child of this nodeoldChildObject
- the node to remove as a child of this nodepublic Node cloneNode(boolean deep)
deep
- if true
, recursively clones all descendantspublic boolean isEqualNode(Node other)
other
- the node to compare withpublic boolean isSameNode(Object other)
other
- the node to test againstpublic boolean hasChildNodes()
public String lookupPrefix(String namespace)
namespace
- string containing the namespace to look the prefix uppublic NodeList getChildNodes()
public final Node getParent()
public Object getParentNode()
parentNode
for the node that
contains the current node.public Node getNextSibling()
nextSibling
for the node that
contains the current node.public Node getPreviousSibling()
previousSibling
for the node that
contains the current node.public Node getFirstChild()
firstChild
for the node that
contains the current node.public Node getLastChild()
lastChild
for the node that
contains the current node.protected Node getJavaScriptNode(DomNode domNode)
domNode
- the DomNodepublic HtmlUnitScriptable getOwnerDocument()
public Node getRootNode()
public int compareDocumentPosition(Object node)
node
- node object that specifies the node to checkNode.compareDocumentPosition(org.w3c.dom.Node)
public void normalize()
public String getTextContent()
public void setTextContent(Object value)
value
- - the new value for the contents of this nodepublic Element getParentElement()
parentElement
.getParentNode()
public NamedNodeMap getAttributes()
public boolean contains(Object element)
element
- element object that specifies the element to checkpublic String getBaseURI()
public boolean hasAttributes()
public String getPrefix()
public String getLocalName()
public String getNamespaceURI()
protected int getChildElementCount()
protected Element getFirstElementChild()
protected Element getLastElementChild()
protected HTMLCollection getChildren()
protected static void after(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void append(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void prepend(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void replaceChildren(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void before(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void replaceWith(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionCopyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.