java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.dom.DOMTokenList
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
DOMTokenList.- Author:
- Ahmed Ashour, Ronald Brill, Marek Gawlicki, Markus Winter
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealedFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance.DOMTokenList(Node node, String attributeName) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Adds the given tokens to the list, omitting any that are already present.booleanChecks if the specified token is contained in the underlying string.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 in the list.get(int index, org.htmlunit.corejs.javascript.Scriptable start) getDefaultValue(Class<?> hint) Returns the JavaScript default value of this object.Object[]getIds().intReturns the length property.getValue()item(int index) Returns the item at the specified index.voidJavaScript constructor.org.htmlunit.corejs.javascript.Scriptablekeys()Returns an Iterator allowing to go through all keys contained in this object.static voidremove(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Removes the specified tokens from the underlying string.booleanReplaces an existing token with a new token.voidbooleanToggle the token, by adding or removing.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.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowOrWorkerGlobalScope, getWithPreemption, has, hasInstance, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMapsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.Scriptable
get, has, hasMethods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable
get, has
-
Constructor Details
-
DOMTokenList
public DOMTokenList()Creates an instance. -
DOMTokenList
Creates an instance.- Parameters:
node- the node which contains the underlying stringattributeName- the attribute name of the DomElement of the specified node
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor. -
getValue
- Returns:
- the value
-
setValue
- Parameters:
value- the new value
-
getLength
public int getLength()Returns the length property.- Returns:
- the length
-
getDefaultValue
Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.- Specified by:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- a hint as to the format of the default value (ignored in this case)- Returns:
- the default value
-
add
public static void add(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Adds the given tokens to the list, omitting any that are already present.- Parameters:
context- the JavaScript contextscope- the scopethisObj- the scriptableargs- the arguments passed into the methodfunction- the function
-
remove
public static void remove(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function function) Removes the specified tokens from the underlying string.- Parameters:
context- the JavaScript contextscope- the scopethisObj- the scriptableargs- the arguments passed into the methodfunction- the function
-
replace
Replaces an existing token with a new token. If the first token doesn't exist, replace() returns false immediately, without adding the new token to the token list.- Parameters:
oldToken- a string representing the token you want to replacenewToken- a string representing the token you want to replace oldToken with- Returns:
- true if oldToken was successfully replaced, or false if not
-
toggle
Toggle the token, by adding or removing.- Parameters:
token- the token to add or remove- Returns:
- whether the string now contains the token or not
-
contains
Checks if the specified token is contained in the underlying string.- Parameters:
token- the token to add- Returns:
- true if the underlying string contains token, otherwise false
-
item
Returns the item at the specified index.- Parameters:
index- the index of the item- Returns:
- the item
-
keys
public org.htmlunit.corejs.javascript.Scriptable keys()Returns an Iterator allowing to go through all keys contained in this object.- Returns:
- a NativeArrayIterator
-
getIds
.- Specified by:
getIdsin interfaceorg.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>- Specified by:
getIdsin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getIdsin classorg.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
-
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 in the list.- Parameters:
callback- function to execute for each element
-
get
- Specified by:
getin interfaceorg.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>- Specified by:
getin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getin classorg.htmlunit.corejs.javascript.ScriptableObject
-