com.gargoylesoftware.htmlunit.javascript.host
Class NodeImpl

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.NodeImpl
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
Direct Known Subclasses:
CharacterDataImpl, Document, DocumentFragment, HTMLElement

public class NodeImpl
extends SimpleScriptable

The javascript object "NodeImpl" which is the base class for all DOM objects. This will typically wrap an instance of DomNode.

Version:
$Revision: 1.3 $
Author:
Mike Bowler, David K. Taylor, Barnaby Court, Christian Sell, George Murnock, Chris Erskine, Bruce Faulkner, Ahmed Ashour
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
NodeImpl()
 Create an instance.
 
Method Summary
 ScriptResult executeEvent(Event event)
 Execute 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
 org.mozilla.javascript.Function getEventHandler(java.lang.String eventName)
 Gets an event handler
 void jsxFunction_addEventListener(java.lang.String type, org.mozilla.javascript.Function listener, boolean useCapture)
 Allows the registration of event listeners on the event target.
 java.lang.Object jsxFunction_appendChild(java.lang.Object childObject)
 Add a DOM node to the node
 boolean jsxFunction_attachEvent(java.lang.String type, org.mozilla.javascript.Function listener)
 Allows the registration of event listeners on the event target.
 java.lang.Object jsxFunction_cloneNode(boolean deep)
 Duplicate an XML node
 void jsxFunction_detachEvent(java.lang.String type, org.mozilla.javascript.Function listener)
 Allows the removal of event listeners on the event target.
 boolean jsxFunction_hasChildNodes()
 Returns whether this node has any children.
 java.lang.Object jsxFunction_insertBefore(java.lang.Object newChildObject, java.lang.Object refChildObject)
 Add a DOM node as a child to this node before the referenced node.
 boolean jsxFunction_isSameNode(java.lang.Object other)
 This method provides a way to determine whether two Node references returned by the implementation reference the same object.
 java.lang.Object jsxFunction_removeChild(java.lang.Object childObject)
 Remove a DOM node from this node
 void jsxFunction_removeEventListener(java.lang.String type, org.mozilla.javascript.Function listener, boolean useCapture)
 Allows the removal of event listeners on the event target.
 java.lang.Object jsxFunction_replaceChild(java.lang.Object newChildObject, java.lang.Object oldChildObject)
 Replace a child DOM node with another DOM node.
 java.lang.Object jsxGet_childNodes()
 Returns the child nodes of the current element.
 java.lang.Object jsxGet_firstChild()
 Get the JavaScript property "firstChild" for the node that contains the current node.
 java.lang.Object jsxGet_lastChild()
 Get the JavaScript property "lastChild" for the node that contains the current node.
 java.lang.Object jsxGet_nextSibling()
 Get the JavaScript property "nextSibling" for the node that contains the current node.
 java.lang.String jsxGet_nodeName()
 Get the JavaScript property "nodeName" for the current node.
 short jsxGet_nodeType()
 Get the JavaScript property "nodeType" for the current node.
 java.lang.String jsxGet_nodeValue()
 Get the JavaScript property "nodeValue" for the current node.
 java.lang.Object jsxGet_parentNode()
 Get the JavaScript property "parentNode" for the node that contains the current node.
 java.lang.Object jsxGet_previousSibling()
 Get the JavaScript property "previousSibling" for the node that contains the current node.
 void jsxSet_nodeValue(java.lang.String newValue)
 Set the JavaScript property "nodeValue" for the current node.
 void setEventHandler(java.lang.String eventName, org.mozilla.javascript.Function eventHandler)
 Defines an event handler
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
get, getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getHtmlElementOrDie, getHtmlElementOrNull, getIntArg, getObjectArg, getStringArg, makeScriptableFor, setDomNode, setHtmlElement
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeImpl

public NodeImpl()
Create an instance.

Method Detail

executeEvent

public ScriptResult executeEvent(Event event)
Execute the event on this object only (needed for instance for onload on (i)frame tags)

Parameters:
event - the event
Returns:
the result

fireEvent

public ScriptResult fireEvent(Event event)
Fires the event on the node with capturing and bubbling phase

Parameters:
event - the event
Returns:
the result

getEventHandler

public org.mozilla.javascript.Function getEventHandler(java.lang.String eventName)
Gets an event handler

Parameters:
eventName - the event name (ex: "onclick")
Returns:
the handler function, null if the property is null or not a function

jsxFunction_addEventListener

public void jsxFunction_addEventListener(java.lang.String type,
                                         org.mozilla.javascript.Function listener,
                                         boolean useCapture)
Allows the registration of event listeners on the event target.

Parameters:
type - the event type to listen for (like "click")
listener - the event listener
useCapture - If true, indicates that the user wishes to initiate capture
See Also:
Mozilla documentation

jsxFunction_appendChild

public java.lang.Object jsxFunction_appendChild(java.lang.Object childObject)
Add a DOM node to the node

Parameters:
childObject - The node to add to this node
Returns:
The newly added child node.

jsxFunction_attachEvent

public boolean jsxFunction_attachEvent(java.lang.String type,
                                       org.mozilla.javascript.Function listener)
Allows the registration of event listeners on the event target.

Parameters:
type - the event type to listen for (like "onclick")
listener - the event listener
Returns:
true if the listener has been added
See Also:
MSDN documentation

jsxFunction_cloneNode

public java.lang.Object jsxFunction_cloneNode(boolean deep)
Duplicate an XML node

Parameters:
deep - If true, recursively clone all descendants. Otherwise, just clone this node.
Returns:
The newly cloned node.

jsxFunction_detachEvent

public void jsxFunction_detachEvent(java.lang.String type,
                                    org.mozilla.javascript.Function listener)
Allows the removal of event listeners on the event target.

Parameters:
type - the event type to listen for (like "onclick")
listener - the event listener
See Also:
MSDN documentation

jsxFunction_hasChildNodes

public boolean jsxFunction_hasChildNodes()
Returns whether this node has any children.

Returns:
boolean true if this node has any children, false otherwise.

jsxFunction_insertBefore

public java.lang.Object jsxFunction_insertBefore(java.lang.Object newChildObject,
                                                 java.lang.Object refChildObject)
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:
newChildObject - The node to add to this node
refChildObject - The node before which to add the new child
Returns:
The newly added child node.

jsxFunction_isSameNode

public boolean jsxFunction_isSameNode(java.lang.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.

jsxFunction_removeChild

public java.lang.Object jsxFunction_removeChild(java.lang.Object childObject)
Remove a DOM node from this node

Parameters:
childObject - The node to remove from this node
Returns:
The removed child node.

jsxFunction_removeEventListener

public void jsxFunction_removeEventListener(java.lang.String type,
                                            org.mozilla.javascript.Function listener,
                                            boolean useCapture)
Allows the removal of event listeners on the event target.

Parameters:
type - the event type to listen for (like "click")
listener - the event listener
useCapture - If true, indicates that the user wishes to initiate capture (not yet implemented)
See Also:
Mozilla documentation

jsxFunction_replaceChild

public java.lang.Object jsxFunction_replaceChild(java.lang.Object newChildObject,
                                                 java.lang.Object oldChildObject)
Replace 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.

jsxGet_childNodes

public java.lang.Object jsxGet_childNodes()
Returns the child nodes of the current element.

Returns:
The child nodes of the current element.

jsxGet_firstChild

public java.lang.Object jsxGet_firstChild()
Get 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.

jsxGet_lastChild

public java.lang.Object jsxGet_lastChild()
Get 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.

jsxGet_nextSibling

public java.lang.Object jsxGet_nextSibling()
Get 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.

jsxGet_nodeName

public java.lang.String jsxGet_nodeName()
Get the JavaScript property "nodeName" for the current node.

Returns:
The node name

jsxGet_nodeType

public short jsxGet_nodeType()
Get the JavaScript property "nodeType" for the current node.

Returns:
The node type

jsxGet_nodeValue

public java.lang.String jsxGet_nodeValue()
Get the JavaScript property "nodeValue" for the current node.

Returns:
The node value

jsxGet_parentNode

public java.lang.Object jsxGet_parentNode()
Get the JavaScript property "parentNode" for the node that contains the current node.

Returns:
The parent node

jsxGet_previousSibling

public java.lang.Object jsxGet_previousSibling()
Get 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.

jsxSet_nodeValue

public void jsxSet_nodeValue(java.lang.String newValue)
Set the JavaScript property "nodeValue" for the current node.

Parameters:
newValue - The new node value

setEventHandler

public void setEventHandler(java.lang.String eventName,
                            org.mozilla.javascript.Function eventHandler)
Defines an event handler

Parameters:
eventName - the event name (like "onclick")
eventHandler - the handler (null to reset it)


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.