public class Node extends EventTarget
Node
which is the base class for all DOM
objects. This will typically wrap an instance of DomNode
.Modifier and Type | Field and Description |
---|---|
static short |
ATTRIBUTE_NODE |
static short |
CDATA_SECTION_NODE |
static short |
COMMENT_NODE |
static short |
DOCUMENT_FRAGMENT_NODE |
static short |
DOCUMENT_NODE |
static short |
DOCUMENT_POSITION_CONTAINED_BY |
static short |
DOCUMENT_POSITION_CONTAINS |
static short |
DOCUMENT_POSITION_DISCONNECTED |
static short |
DOCUMENT_POSITION_FOLLOWING |
static short |
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
static short |
DOCUMENT_POSITION_PRECEDING |
static short |
DOCUMENT_TYPE_NODE |
static short |
ELEMENT_NODE |
static short |
ENTITY_NODE |
static short |
ENTITY_REFERENCE_NODE |
static short |
NOTATION_NODE |
static short |
PROCESSING_INSTRUCTION_NODE |
static short |
TEXT_NODE |
Constructor and Description |
---|
Node()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
after(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.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.
|
Object |
appendChild(Object childObject)
Adds a DOM node to the node.
|
protected net.sourceforge.htmlunit.corejs.javascript.RhinoException |
asJavaScriptException(DOMException exception)
Encapsulates the given
DOMException into a Rhino-compatible exception. |
protected static void |
before(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.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.
|
Object |
cloneNode(boolean deep)
Clones this node.
|
short |
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.
|
Object |
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.
|
Object |
getLocalName()
Returns the local name of this attribute.
|
Object |
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. |
short |
getNodeType()
Gets the JavaScript property
nodeType for the current node. |
String |
getNodeValue()
Gets the JavaScript property
nodeValue for the current node. |
Object |
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. |
Object |
getPrefix()
Returns the namespace prefix.
|
Node |
getPreviousSibling()
Gets the JavaScript property
previousSibling for the node that
contains the current node. |
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 Object |
insertBefore(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
Add a DOM node as a child to this node before the referenced node.
|
protected Object |
insertBeforeImpl(Object[] args)
Add a DOM node as a child to this node before the referenced node.
|
boolean |
isSameNode(Object other)
This method provides a way to determine whether two Node references returned by
the implementation reference the same object.
|
void |
normalize()
Merges adjacent TextNode objects to produce a normalized document object model.
|
protected void |
remove()
Removes the DOM node from its parent.
|
Object |
removeChild(Object childObject)
Removes a DOM node from this node.
|
Object |
replaceChild(Object newChildObject,
Object oldChildObject)
Replaces a child DOM node with another DOM node.
|
protected static void |
replaceWith(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.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, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, put, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isReadOnlySettable, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, size
public static final short ELEMENT_NODE
Node.ELEMENT_NODE
,
Constant Field Valuespublic static final short ATTRIBUTE_NODE
Node.ATTRIBUTE_NODE
,
Constant Field Valuespublic static final short TEXT_NODE
Node.TEXT_NODE
,
Constant Field Valuespublic static final short CDATA_SECTION_NODE
Node.CDATA_SECTION_NODE
,
Constant Field Valuespublic static final short ENTITY_REFERENCE_NODE
Node.ENTITY_REFERENCE_NODE
,
Constant Field Valuespublic static final short ENTITY_NODE
Node.ENTITY_NODE
,
Constant Field Valuespublic static final short PROCESSING_INSTRUCTION_NODE
public static final short COMMENT_NODE
Node.COMMENT_NODE
,
Constant Field Valuespublic static final short DOCUMENT_NODE
Node.DOCUMENT_NODE
,
Constant Field Valuespublic static final short DOCUMENT_TYPE_NODE
Node.DOCUMENT_TYPE_NODE
,
Constant Field Valuespublic static final short DOCUMENT_FRAGMENT_NODE
Node.DOCUMENT_FRAGMENT_NODE
,
Constant Field Valuespublic static final short NOTATION_NODE
Node.NOTATION_NODE
,
Constant Field Valuespublic static final short DOCUMENT_POSITION_DISCONNECTED
public static final short DOCUMENT_POSITION_PRECEDING
public static final short DOCUMENT_POSITION_FOLLOWING
public static final short DOCUMENT_POSITION_CONTAINS
public static final short DOCUMENT_POSITION_CONTAINED_BY
public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
public short 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 Object appendChild(Object childObject)
childObject
- the node to add to this nodeprotected net.sourceforge.htmlunit.corejs.javascript.RhinoException asJavaScriptException(DOMException exception)
DOMException
into a Rhino-compatible exception.exception
- the exception to encapsulatepublic static Object insertBefore(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
context
- the JavaScript contextthisObj
- the scriptableargs
- the arguments passed into the methodfunction
- the functionprotected Object insertBeforeImpl(Object[] args)
args
- the argumentsprotected void remove()
public Object removeChild(Object childObject)
childObject
- the node to remove from this nodepublic Object 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 Object cloneNode(boolean deep)
deep
- if true
, recursively clones all descendantspublic boolean isSameNode(Object other)
other
- the node to test againstpublic boolean hasChildNodes()
public 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 Object getOwnerDocument()
public short 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 Object getAttributes()
public boolean contains(Object element)
element
- element object that specifies the element to checkpublic String getBaseURI()
public boolean hasAttributes()
public Object getPrefix()
public Object getLocalName()
public Object getNamespaceURI()
protected int getChildElementCount()
protected Element getFirstElementChild()
protected Element getLastElementChild()
protected HTMLCollection getChildren()
protected static void after(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void before(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionprotected static void replaceWith(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionCopyright © 2002–2021 Gargoyle Software Inc.. All rights reserved.