Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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.

interface DOMTokenList {
[index: number]: string;
readonly length: number;
value: string;
[[Symbol.iterator]](): IterableIterator<string>;
add(...tokens: string[]): void;
contains(token: string): boolean;
entries(): IterableIterator<[number, string]>;
forEach(callbackfn: (
value: string,
key: number,
parent: DOMTokenList,
) => void
, thisArg?: any): void;
item(index: number): string | null;
keys(): IterableIterator<number>;
remove(...tokens: string[]): void;
replace(token: string, newToken: string): boolean;
supports(token: string): boolean;
toggle(token: string, force?: boolean): boolean;
toString(): string;
values(): IterableIterator<string>;
}
var DOMTokenList: {
prototype: DOMTokenList;
new (): DOMTokenList;
}
;

§Index Signatures

§
[index: number]: string

§Properties

§
readonly length: number
[src]

Returns the number of tokens.

§
value: string
[src]

Returns the associated set as string.

Can be set, to change the associated attribute.

§Methods

§
[[Symbol.iterator]](): IterableIterator<string>
[src]
§
add(...tokens: string[]): void
[src]

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.

§
contains(token: string): boolean
[src]

Returns true if token is present, and false otherwise.

§
entries(): IterableIterator<[number, string]>
[src]
§
forEach(callbackfn: (
value: string,
key: number,
parent: DOMTokenList,
) => void
, thisArg?: any): void
[src]
§
item(index: number): string | null
[src]

Returns the token with index index.

§
keys(): IterableIterator<number>
[src]
§
remove(...tokens: string[]): void
[src]

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.

§
replace(token: string, newToken: string): boolean
[src]

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.

§
supports(token: string): boolean
[src]

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.

§
toggle(token: string, force?: boolean): boolean
[src]

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.

§
toString(): string
[src]
§
values(): IterableIterator<string>
[src]