com.gargoylesoftware.htmlunit.javascript
Class HTMLCollection

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.HTMLCollection
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.Callable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Function, org.mozilla.javascript.Scriptable

public class HTMLCollection
extends SimpleScriptable
implements org.mozilla.javascript.Function

An array of elements. Used for the element arrays returned by document.all, document.all.tags('x'), document.forms, window.frames, etc. Note that this class must not be used for collections that can be modified, for example map.areas and select.options.
This class (like all classes in this package) is specific for the javascript engine. Users of HtmlUnit shouldn't use it directly.

Version:
$Revision: 1.3 $
Author:
Daniel Gredler, Marc Guillemot, Chris Erskine, 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
HTMLCollection()
 Create an instance.
HTMLCollection(SimpleScriptable parentScope)
 Create an instance
 
Method Summary
 java.lang.Object call(org.mozilla.javascript.Context context, org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args)
 
 org.mozilla.javascript.Scriptable construct(org.mozilla.javascript.Context arg0, org.mozilla.javascript.Scriptable arg1, java.lang.Object[] arg2)
 
 java.lang.Object get(int index, org.mozilla.javascript.Scriptable start)
 Returns the element at the specified index, or NOT_FOUND if the index is invalid.
 void init(DomNode node, org.jaxen.XPath xpath)
 Init the content of this collection.
 void init(DomNode node, org.jaxen.XPath xpath, org.apache.commons.collections.Transformer transformer)
 Init the content of this collection.
 java.lang.Object jsxFunction_item(java.lang.Object index)
 Retrieves the item or items corresponding to the specified index or key.
 java.lang.Object jsxFunction_namedItem(java.lang.String name)
 Retrieves the item or items corresponding to the specified name (checks ids, and if that does not work, then names).
 java.lang.Object jsxFunction_tags(java.lang.String tagName)
 Returns all the elements in this element array that have the specified tag name.
 int jsxGet_length()
 Returns the length of this element array.
 java.lang.String toString()
 Just for debug purpose.
 
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, 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, wait, wait, wait
 
Methods inherited from interface org.mozilla.javascript.Scriptable
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, put, setParentScope, setPrototype
 

Constructor Detail

HTMLCollection

public HTMLCollection()
Create an instance. Javascript objects must have a default constructor.


HTMLCollection

public HTMLCollection(SimpleScriptable parentScope)
Create an instance

Parameters:
parentScope - parent scope
Method Detail

call

public final java.lang.Object call(org.mozilla.javascript.Context context,
                                   org.mozilla.javascript.Scriptable scope,
                                   org.mozilla.javascript.Scriptable thisObj,
                                   java.lang.Object[] args)
                            throws org.mozilla.javascript.JavaScriptException

Specified by:
call in interface org.mozilla.javascript.Callable
Specified by:
call in interface org.mozilla.javascript.Function
Throws:
org.mozilla.javascript.JavaScriptException

construct

public final org.mozilla.javascript.Scriptable construct(org.mozilla.javascript.Context arg0,
                                                         org.mozilla.javascript.Scriptable arg1,
                                                         java.lang.Object[] arg2)
                                                  throws org.mozilla.javascript.JavaScriptException

Specified by:
construct in interface org.mozilla.javascript.Function
Throws:
org.mozilla.javascript.JavaScriptException

get

public final java.lang.Object get(int index,
                                  org.mozilla.javascript.Scriptable start)
Returns the element at the specified index, or NOT_FOUND if the index is invalid.

Specified by:
get in interface org.mozilla.javascript.Scriptable
Overrides:
get in class org.mozilla.javascript.ScriptableObject

init

public void init(DomNode node,
                 org.jaxen.XPath xpath)
Init the content of this collection. The elements will be "calculated" at each access using the xpath applied on the node.

Parameters:
node - the node to serve as root for the xpath expression
xpath - the xpath giving the elements of the collection

init

public void init(DomNode node,
                 org.jaxen.XPath xpath,
                 org.apache.commons.collections.Transformer transformer)
Init the content of this collection. The elements will be "calculated" at each access using the xpath applied on the node and transformed using the transformer.

Parameters:
node - the node to serve as root for the xpath expression
xpath - the xpath giving the elements of the collection
transformer - the transformer allowing to get the expected objects from the xpath evaluation

jsxFunction_item

public final java.lang.Object jsxFunction_item(java.lang.Object index)
Retrieves the item or items corresponding to the specified index or key.

Parameters:
index - The index or key corresponding to the element or elements to return.
Returns:
The element or elements corresponding to the specified index or key.
See Also:
MSDN doc

jsxFunction_namedItem

public final java.lang.Object jsxFunction_namedItem(java.lang.String name)
Retrieves the item or items corresponding to the specified name (checks ids, and if that does not work, then names).

Parameters:
name - The name or id the element or elements to return.
Returns:
The element or elements corresponding to the specified name or id.
See Also:
MSDN doc

jsxFunction_tags

public final java.lang.Object jsxFunction_tags(java.lang.String tagName)
Returns all the elements in this element array that have the specified tag name. This method returns an empty element array if there are no elements with the specified tag name.

Parameters:
tagName - The name of the tag of the elements to return.
Returns:
All the elements in this element array that have the specified tag name.
See Also:
MSDN doc

jsxGet_length

public final int jsxGet_length()
Returns the length of this element array.

Returns:
The length of this element array.
See Also:
MSDN doc

toString

public java.lang.String toString()
Just for debug purpose.

Overrides:
toString in class java.lang.Object


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