Package org.htmlunit.javascript.host.dom
Class NodeList
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.dom.AbstractList
org.htmlunit.javascript.host.dom.NodeList
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.Callable,org.htmlunit.corejs.javascript.ConstProperties,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.ExternalArrayData,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
- Direct Known Subclasses:
LabelsNodeList,RadioNodeList
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.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.dom.AbstractList
AbstractList.EffectOnCacheNested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args) protected AbstractListConstructs a new instance with an initial cache value.org.htmlunit.corejs.javascript.Scriptableentries()Returns an Iterator allowing to go through all key/value pairs contained in this object.voidCalls thecallbackgiven in parameter once for each value pair in the list, in insertion order.final intReturns the length.Returns the item or items corresponding to the specified index or key.voidJavaScript constructor.org.htmlunit.corejs.javascript.Scriptablekeys()Returns an Iterator allowing to go through all keys contained in this object.static NodeListstaticNodeList(HtmlUnitScriptable parentScope, List<DomNode> elements) Gets a static NodeList.org.htmlunit.corejs.javascript.Scriptablevalues()Returns an Iterator allowing to go through all keys contained in this object.Methods inherited from class org.htmlunit.javascript.host.dom.AbstractList
avoidObjectDetection, defineProperty, equivalentValues, getArrayElement, getArrayLength, getElements, getElementSupplier, getIsMatchingPredicate, getIt, getScriptableForElement, getWithPreemption, getWithPreemptionByName, setArrayElement, setAvoidObjectDetection, setDomNode, setEffectOnCacheFunction, setElementsSupplier, setIsMatchingPredicate, toStringMethods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, 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
-
Constructor Details
-
NodeList
public NodeList()Creates an instance. -
NodeList
Creates an instance.- Parameters:
domNode- theDomNodeattributeChangeSensitive- indicates if the content of the collection may change when an attribute of a descendant node of parentScope changes (attribute added, modified or removed)
-
NodeList
Constructs an instance with an initial cache value.- Parameters:
domNode- the parent scope, on which we listen for changesinitialElements- the initial content for the cache
-
NodeList
NodeList(org.htmlunit.corejs.javascript.ScriptableObject parentScope) Creates an instance.- Parameters:
parentScope- the parent scope
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor. -
staticNodeList
Gets a static NodeList.- Parameters:
parentScope- the parent scopeelements- the elements- Returns:
- an empty collection
-
keys
public org.htmlunit.corejs.javascript.Scriptable keys()Returns an Iterator allowing to go through all keys contained in this object.- Returns:
- a NativeArrayIterator
-
values
public org.htmlunit.corejs.javascript.Scriptable values()Returns an Iterator allowing to go through all keys contained in this object.- Returns:
- a NativeArrayIterator
-
entries
public org.htmlunit.corejs.javascript.Scriptable entries()Returns an Iterator allowing to go through all key/value pairs contained in this object.- Returns:
- a NativeArrayIterator
-
forEach
Calls thecallbackgiven in parameter once for each value pair in the list, in insertion order.- Parameters:
callback- function to execute for each element
-
getLength
public final int getLength()Returns the length.- Overrides:
getLengthin classAbstractList- Returns:
- the length
-
item
Returns 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:
-
call
public Object call(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args) - Specified by:
callin interfaceorg.htmlunit.corejs.javascript.Callable
-
create
Constructs a new instance with an initial cache value.- Overrides:
createin classAbstractList- Parameters:
parentScope- the parent scope, on which we listen for changesinitialElements- the initial content for the cache- Returns:
- the newly created instance
-