public class AbstractList extends SimpleScriptable implements net.sourceforge.htmlunit.corejs.javascript.Function
NodeList
and HTMLCollection
.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractList.EffectOnCache
Cache effect of some changes.
|
Modifier | Constructor and Description |
---|---|
|
AbstractList()
Creates an instance.
|
|
AbstractList(DomNode domeNode,
boolean attributeChangeSensitive)
Creates an instance.
|
protected |
AbstractList(DomNode domNode,
List<?> initialElements)
Creates an instance with an initial cache value.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addElementIds(List<String> idList,
List<Object> elements)
Adds the ids of the collection's elements to the idList.
|
boolean |
avoidObjectDetection()
Only needed to make collections like document.all available but "invisible" when simulating Firefox.
|
Object |
call(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args) |
protected List<Object> |
computeElements()
Returns the elements whose associated host objects are available through this collection.
|
net.sourceforge.htmlunit.corejs.javascript.Scriptable |
construct(net.sourceforge.htmlunit.corejs.javascript.Context cx,
net.sourceforge.htmlunit.corejs.javascript.Scriptable scope,
Object[] args) |
protected AbstractList |
create(DomNode parentScope,
List<?> initialElements)
Constructs a new instance with an initial cache value.
|
protected Object |
equivalentValues(Object other)
Called for the js "==".
|
Object |
get(int index,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Returns the element at the specified index, or
Scriptable.NOT_FOUND if the index is invalid. |
protected Iterable<DomNode> |
getCandidates()
Gets the DOM node that have to be examined to see if they are matching.
|
protected AbstractList.EffectOnCache |
getEffectOnCache(HtmlAttributeChangeEvent event)
Gets the effect of the change on an attribute of the reference node
on this collection's cache.
|
List<Object> |
getElements()
Gets the HTML elements from cache or retrieve them at first call.
|
Object[] |
getIds()
.
|
int |
getLength()
Returns the length.
|
protected net.sourceforge.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<Object> elements)
Helper for
getWithPreemption(String) when finding by id doesn't get results. |
boolean |
has(int index,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start) |
boolean |
has(String name,
net.sourceforge.htmlunit.corejs.javascript.Scriptable start) |
protected boolean |
isMatching(DomNode node)
Indicates if the node should belong to the collection.
|
Object |
item(Object index)
Returns the item or items corresponding to the specified index or key.
|
void |
setAvoidObjectDetection(boolean newValue) |
protected void |
setDomNode(DomNode domNode,
boolean assignScriptObject)
Sets the DOM node that corresponds to this JavaScript object.
|
String |
toString() |
clone, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, 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, setExternalArrayData, setGetterOrSetter, setPrototype, size
public AbstractList()
public AbstractList(DomNode domeNode, boolean attributeChangeSensitive)
domeNode
- 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)public boolean avoidObjectDetection()
avoidObjectDetection
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public void setAvoidObjectDetection(boolean newValue)
newValue
- the new valuepublic Object call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
call
in interface net.sourceforge.htmlunit.corejs.javascript.Callable
call
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public final net.sourceforge.htmlunit.corejs.javascript.Scriptable construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, Object[] args)
construct
in interface net.sourceforge.htmlunit.corejs.javascript.Function
public final Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Scriptable.NOT_FOUND
if the index is invalid.
get
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
get
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
protected void setDomNode(DomNode domNode, boolean assignScriptObject)
SimpleScriptable
setDomNode
in class SimpleScriptable
domNode
- the DOM nodeassignScriptObject
- If true, call setScriptObject
on domNodepublic List<Object> getElements()
HtmlElement
contained in this collectionprotected List<Object> computeElements()
protected Iterable<DomNode> getCandidates()
protected boolean isMatching(DomNode node)
node
- the node to test. Will be a child node of the reference node.false
here as subclasses for concrete collections should decide it.protected Object getWithPreemption(String name)
Scriptable.NOT_FOUND
is returned.
Called by SimpleScriptable.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 SimpleScriptable
name
- the property nameScriptable.NOT_FOUND
if not foundprotected AbstractList create(DomNode parentScope, List<?> initialElements)
parentScope
- the parent scope, on which we listen for changesinitialElements
- the initial content for the cacheprotected Object getWithPreemptionByName(String name, List<Object> elements)
getWithPreemption(String)
when finding by id doesn't get results.name
- the property nameelements
- the children elements.Scriptable.NOT_FOUND
if not foundpublic final int getLength()
public Object item(Object index)
index
- the index or key corresponding to the element or elements to returnprotected Object equivalentValues(Object other)
equivalentValues
in class SimpleScriptable
public boolean has(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
has
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
has
in class SimpleScriptable
public boolean has(String name, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
has
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
has
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
public Object[] getIds()
getIds
in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
getIds
in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
protected void addElementIds(List<String> idList, List<Object> elements)
idList
- the list to add the ids toelements
- the collection's elementsprotected AbstractList.EffectOnCache getEffectOnCache(HtmlAttributeChangeEvent event)
event
- the change eventprotected net.sourceforge.htmlunit.corejs.javascript.Scriptable getScriptableForElement(Object object)
object
- the object for which to get the scriptableCopyright © 2002–2018 Gargoyle Software Inc.. All rights reserved.