Interface

DOMTokenList

DOMTokenList

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.

View Source js/lib.dom.d.ts, line 986

Members

void

# add

Adds all arguments passed, except those already present.

Throws a "SyntaxError" DOMException if one of the arguments is the empty string.

Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.

View Source js/lib.dom.d.ts, line 1001

boolean

# contains

Returns true if token is present, and false otherwise.

View Source js/lib.dom.d.ts, line 1010

string | null

# item

Returns the token with index index.

View Source js/lib.dom.d.ts, line 1015

number

# length

Returns the number of tokens.

View Source js/lib.dom.d.ts, line 989

void

# remove

Removes arguments passed, if they are present.

Throws a "SyntaxError" DOMException if one of the arguments is the empty string.

Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.

View Source js/lib.dom.d.ts, line 1020

void

# replace

Replaces token with newToken.

Returns true if token was replaced with newToken, and false otherwise.

Throws a "SyntaxError" DOMException if one of the arguments is the empty string.

Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace.

View Source js/lib.dom.d.ts, line 1029

boolean

# supports

Returns true if token is in the associated attribute's supported tokens. Returns false otherwise.

Throws a TypeError if the associated attribute has no supported tokens defined.

View Source js/lib.dom.d.ts, line 1040

boolean

# toggle

If force is not given, "toggles" token, removing it if it's present and adding it if it's not present. If force is true, adds token (same as add()). If force is false, removes token (same as remove()).

Returns true if token is now present, and false otherwise.

Throws a "SyntaxError" DOMException if token is empty.

Throws an "InvalidCharacterError" DOMException if token contains any spaces.

View Source js/lib.dom.d.ts, line 1047

string

# value

Returns the associated set as string.

Can be set, to change the associated attribute.

View Source js/lib.dom.d.ts, line 994