public class AbstractList extends HtmlUnitScriptable implements org.htmlunit.corejs.javascript.ExternalArrayData
NodeList
and HTMLCollection
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractList.EffectOnCache
Cache effect of some changes.
|
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Modifier | Constructor and Description |
---|---|
|
AbstractList()
Creates an instance.
|
protected |
AbstractList(DomNode domNode,
boolean attributeChangeSensitive,
List<DomNode> initialElements)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
avoidObjectDetection()
Only needed to make collections like
document.all available but "invisible" when simulating Firefox. |
protected AbstractList |
create(DomNode parentScope,
List<DomNode> initialElements)
Constructs a new instance with an initial cache value.
|
void |
defineProperty(String propertyName,
Object delegateTo,
Method getter,
Method setter,
int attributes) |
protected Object |
equivalentValues(Object other)
Called for the js "==".
|
Object |
getArrayElement(int index) |
int |
getArrayLength() |
List<DomNode> |
getElements()
Gets the HTML elements from cache or retrieve them at first call.
|
protected Supplier<List<DomNode>> |
getElementSupplier() |
protected Predicate<DomNode> |
getIsMatchingPredicate() |
protected Object |
getIt(Object o)
Private helper that retrieves the item or items corresponding to the specified
index or key.
|
int |
getLength()
Returns the length.
|
protected org.htmlunit.corejs.javascript.Scriptable |
getScriptableForElement(Object object)
Gets the scriptable for the provided element that may already be the right scriptable.
|
protected Object |
getWithPreemption(String name)
Returns the element or elements that match the specified key.
|
protected Object |
getWithPreemptionByName(String name,
List<DomNode> elements)
Helper for
getWithPreemption(String) when finding by id doesn't get results. |
void |
setArrayElement(int index,
Object value) |
void |
setAvoidObjectDetection(boolean newValue) |
void |
setDomNode(DomNode domNode,
boolean assignScriptObject)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
void |
setEffectOnCacheFunction(Function<HtmlAttributeChangeEvent,AbstractList.EffectOnCache> effectOnCacheFunction) |
void |
setElementsSupplier(Supplier<List<DomNode>> elementsSupplier)
Returns the elements whose associated host objects are available through this collection.
|
void |
setIsMatchingPredicate(Predicate<DomNode> isMatchingPredicate)
Indicates if the node should belong to the collection.
|
String |
toString() |
clone, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, 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
public AbstractList()
protected AbstractList(DomNode domNode, boolean attributeChangeSensitive, List<DomNode> initialElements)
domNode
- the DomNode
attributeChangeSensitive
- indicates if the content of the collection may change when an attribute
of a descendant node of parentScope changes (attribute added, modified or removed)initialElements
- the initial content for the cachepublic boolean avoidObjectDetection()
document.all
available but "invisible" when simulating Firefox.
avoidObjectDetection
in class org.htmlunit.corejs.javascript.ScriptableObject
public void setAvoidObjectDetection(boolean newValue)
newValue
- the new valuepublic void setEffectOnCacheFunction(Function<HtmlAttributeChangeEvent,AbstractList.EffectOnCache> effectOnCacheFunction)
effectOnCacheFunction
- the new functionpublic void setElementsSupplier(Supplier<List<DomNode>> elementsSupplier)
elementsSupplier
- the new supplierprotected Predicate<DomNode> getIsMatchingPredicate()
public void setIsMatchingPredicate(Predicate<DomNode> isMatchingPredicate)
isMatchingPredicate
- the new predicateprotected Object getIt(Object o)
o
- the index or key corresponding to the element or elements to returnpublic void setDomNode(DomNode domNode, boolean assignScriptObject)
HtmlUnitScriptable
setDomNode
in class HtmlUnitScriptable
domNode
- the DOM nodeassignScriptObject
- If true, call setScriptObject
on domNodepublic List<DomNode> getElements()
HtmlElement
contained in this collectionprotected Object getWithPreemption(String name)
Scriptable.NOT_FOUND
is returned.
Called by HtmlUnitScriptable.get(String, Scriptable)
to allow retrieval of the property before the prototype
chain is searched.
IMPORTANT: This method is invoked *very* often by Rhino. If you override this method, the implementation needs to be as fast as possible!
getWithPreemption
in class HtmlUnitScriptable
name
- the property nameScriptable.NOT_FOUND
if not foundprotected AbstractList create(DomNode parentScope, List<DomNode> initialElements)
parentScope
- the parent scope, on which we listen for changesinitialElements
- the initial content for the cacheprotected Object getWithPreemptionByName(String name, List<DomNode> elements)
getWithPreemption(String)
when finding by id doesn't get results.name
- the property nameelements
- the children elements.Scriptable.NOT_FOUND
if not foundpublic int getLength()
protected Object equivalentValues(Object other)
equivalentValues
in class HtmlUnitScriptable
protected org.htmlunit.corejs.javascript.Scriptable getScriptableForElement(Object object)
object
- the object for which to get the scriptablepublic void defineProperty(String propertyName, Object delegateTo, Method getter, Method setter, int attributes)
defineProperty
in class org.htmlunit.corejs.javascript.ScriptableObject
public Object getArrayElement(int index)
getArrayElement
in interface org.htmlunit.corejs.javascript.ExternalArrayData
public void setArrayElement(int index, Object value)
setArrayElement
in interface org.htmlunit.corejs.javascript.ExternalArrayData
public int getArrayLength()
getArrayLength
in interface org.htmlunit.corejs.javascript.ExternalArrayData
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.