DOMTokenList extension type

The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList or HTMLLinkElement.relList, and many others.

A DOMTokenList is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive.


API documentation sourced from MDN Web Docs.

on
Implemented types
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
The read-only length property of the DOMTokenList interface is an integer representing the number of objects stored in the object.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
The value property of the DOMTokenList interface is a that returns the value of the list serialized as a string, or clears and sets the list to the given value.
getter/setter pair

Methods

add(String tokens) → void
The add() method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present.
contains(String token) bool
The contains() method of the DOMTokenList interface returns a boolean value — true if the underlying list contains the given token, otherwise false.
item(int index) String?
The item() method of the DOMTokenList interface returns an item in the list, determined by its position in the list, its index.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String tokens) → void
The remove() method of the DOMTokenList interface removes the specified tokens from the list.
replace(String token, String newToken) bool
The replace() method of the DOMTokenList interface 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.
supports(String token) bool
The supports() method of the DOMTokenList interface returns true if a given token is in the associated attribute's supported tokens. This method is intended to support feature detection.
toggle(String token, [bool force]) bool
The toggle() method of the DOMTokenList interface removes an existing token from the list and returns false. If the token doesn't exist it's added and the function returns true.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited