DOMTokenList
interface represents a set of space-separated tokens. Such a set is returned by Element.classList
, HTMLLinkElement.relList
, HTMLAnchorElement.relList
, HTMLAreaElement.relList
, HTMLIframeElement.sandbox
, or HTMLOutputElement.htmlFor
. It is indexed beginning with 0
as with JavaScript Array
objects. DOMTokenList
is always case-sensitive.Is an integer
representing the number of objects stored in the object.
Promise<number>
A stringifier property that returns the value of the list as a string
.
Promise<string>
Adds the specified token
(s) to the list.
string
. A string
representing the token (or tokens) to add to the tokenList
.Promise<void>
Returns true
if the list contains the given token
, otherwise false
.
string
. A string
representing the token you want to check for the existance of in the list.Promise<boolean>
Returns an iterator
, allowing you to go through all key/value pairs contained in this object.
Promise<>
Executes a provided callback
function once per DOMTokenList
element.
Promise<>
Returns the item in the list by its index
, or undefined
if index
is greater than or equal to the list's length
.
number
. A string
representing the index of the item you want to return.Promise<string>
Returns an iterator
, allowing you to go through all keys of the key/value pairs contained in this object.
Promise<>
Removes the specified token
(s) from the list.
string
. A string
representing the token you want to remove from the list. If the string is not in the list, no error is thrown, and nothing happens.Promise<void>
Replaces token
with newToken
.
string
. A string
representing the token you want to replace.string
. A string
representing the token you want to replace oldToken
with.Promise<boolean>
Returns true
if a given token
is in the associated attribute's supported tokens.
string
. A string
containing the token to query for.Promise<boolean>
Removes token
from the list if it exists, or adds token
to the list if it doesn't. Returns a boolean indicating whether token
is in the list after the operation.
string
. A string
representing the token you want to toggle.boolean
. A boolean
that, if included, turns the toggle into a one way-only operation. If set to false
, then token
will only be removed, but not added. If set to true
, then token
will only be added, but not removed.Promise<boolean>
Returns an iterator
, allowing you to go through all values of the key/value pairs contained in this object.
Promise<>