|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.htmlunit.corejs.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
com.gargoylesoftware.htmlunit.javascript.host.Node
public class Node
The JavaScript object "Node" which is the base class for all DOM
objects. This will typically wrap an instance of DomNode.
| Field Summary | |
|---|---|
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
|
| Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
Node()
Creates an instance. |
|
| Method Summary | |
|---|---|
void |
addEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the registration of event listeners on the event target. |
Object |
appendChild(Object childObject)
Adds a DOM node to the node. |
boolean |
attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the registration of event listeners on the event target. |
Object |
cloneNode(boolean deep)
Clones this node. |
short |
compareDocumentPosition(Node node)
Compares the positions of this node and the provided node within the document. |
void |
detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
Allows the removal of event listeners on the event target. |
ScriptResult |
executeEvent(Event event)
Executes the event on this object only (needed for instance for onload on (i)frame tags). |
ScriptResult |
fireEvent(Event event)
Fires the event on the node with capturing and bubbling phase. |
static ScriptResult |
fireEvent(SimpleScriptable scriptable,
Event event)
Fires the event on the node with capturing and bubbling phase. |
Object |
getAttributes()
Returns the attributes of this XML element. |
NodeList |
getChildNodes()
Returns the child nodes of the current element. |
net.sourceforge.htmlunit.corejs.javascript.Function |
getEventHandler(String eventName)
Returns the specified event handler. |
protected Object |
getEventHandlerProp(String eventName)
Gets the property defined as event handler (not necessary a Function if something else has been set). |
Node |
getFirstChild()
Gets the JavaScript property "firstChild" for the node that contains the current node. |
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. |
String |
getLocalName()
Returns the local name of this element. |
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. |
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. |
String |
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. |
Object |
getXml()
Represents the xml content of the node and its descendants. |
boolean |
hasChildNodes()
Returns whether this node has any children. |
boolean |
hasEventHandlers(String eventName)
Returns true if there are any event handlers for the specified event. |
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. |
Object |
removeChild(Object childObject)
Removes a DOM node from this node. |
void |
removeEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
Allows the removal of event listeners on the event target. |
Object |
replaceChild(Object newChildObject,
Object oldChildObject)
Replaces a child DOM node with another DOM node. |
void |
setDomNode(DomNode domNode)
Sets the DOM node that corresponds to this JavaScript object. |
void |
setEventHandler(String eventName,
net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
Defines an event handler. |
protected void |
setEventHandlerProp(String eventName,
Object value)
Defines an event handler (or maybe any other object). |
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. |
| Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
|---|
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement |
| Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject |
|---|
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
Node.PROCESSING_INSTRUCTION_NODE,
Constant Field Valuespublic 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
Node.DOCUMENT_POSITION_DISCONNECTED,
Constant Field Valuespublic static final short DOCUMENT_POSITION_PRECEDING
Node.DOCUMENT_POSITION_PRECEDING,
Constant Field Valuespublic static final short DOCUMENT_POSITION_FOLLOWING
Node.DOCUMENT_POSITION_FOLLOWING,
Constant Field Valuespublic static final short DOCUMENT_POSITION_CONTAINS
Node.DOCUMENT_POSITION_CONTAINS,
Constant Field Valuespublic static final short DOCUMENT_POSITION_CONTAINED_BY
Node.DOCUMENT_POSITION_CONTAINED_BY,
Constant Field Valuespublic static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC,
Constant Field Values| Constructor Detail |
|---|
public Node()
| Method Detail |
|---|
public short getNodeType()
public String getNodeName()
public String getNodeValue()
public void setNodeValue(String newValue)
newValue - the new node valuepublic Object appendChild(Object childObject)
childObject - the node to add to this node
public Object cloneNode(boolean deep)
deep - if true, recursively clones all descendants
public 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 function
protected Object insertBeforeImpl(Object[] args)
args - the arguments
public boolean isSameNode(Object other)
other - the node to test against
public Object removeChild(Object childObject)
childObject - the node to remove from this node
public boolean hasChildNodes()
public NodeList getChildNodes()
public 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 node
public Node getParent()
public Object getParentNode()
public Node getNextSibling()
public Node getPreviousSibling()
public Node getFirstChild()
public Node getLastChild()
protected Node getJavaScriptNode(DomNode domNode)
domNode - the DomNode
public boolean attachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
type - the event type to listen for (like "onclick")listener - the event listener
true if the listener has been addedaddEventListener(String, Function, boolean)
public void addEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
type - the event type to listen for (like "click")listener - the event listeneruseCapture - If true, indicates that the user wishes to initiate captureattachEvent(String, Function)
public void detachEvent(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener)
type - the event type to listen for (like "onclick")listener - the event listener
public void removeEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Function listener,
boolean useCapture)
type - the event type to listen for (like "click")listener - the event listeneruseCapture - If true, indicates that the user wishes to initiate capture (not yet implemented)public ScriptResult executeEvent(Event event)
event - the event
public ScriptResult fireEvent(Event event)
event - the event
public static ScriptResult fireEvent(SimpleScriptable scriptable,
Event event)
scriptable - the scriptable to fire the eventevent - the event
public net.sourceforge.htmlunit.corejs.javascript.Function getEventHandler(String eventName)
eventName - the event name (e.g. "onclick")
public boolean hasEventHandlers(String eventName)
eventName - the event name (e.g. "onclick")
public void setEventHandler(String eventName,
net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
eventName - the event name (e.g. "onclick")eventHandler - the handler (null to reset it)
protected void setEventHandlerProp(String eventName,
Object value)
eventName - the event name (e.g. "onclick")value - the property (null to reset it)protected Object getEventHandlerProp(String eventName)
eventName - the event name (e.g. "onclick")
public Object getOwnerDocument()
public String getPrefix()
public String getLocalName()
public String getNamespaceURI()
public void setDomNode(DomNode domNode)
setDomNode in class SimpleScriptabledomNode - the DOM nodepublic short compareDocumentPosition(Node node)
node - node object that specifies the node to check
Node.compareDocumentPosition(org.w3c.dom.Node)public void normalize()
public Object getXml()
public String getTextContent()
public void setTextContent(Object value)
value - - the new value for the contents of this nodepublic Element getParentElement()
getParentNode()public Object getAttributes()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||