Skip to content

DOMTokenList

Values

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. Read more on MDN

let add: (WebAPI.DOMAPI.domTokenList, string) => unit

Parameters

WebAPI.DOMAPI.domTokenList string

Return type

unit

contains

Returns true if token is present, and false otherwise. Read more on MDN

let contains: (WebAPI.DOMAPI.domTokenList, string) => bool

Parameters

WebAPI.DOMAPI.domTokenList string

Return type

bool

item

Returns the token with index index. Read more on MDN

let item: (WebAPI.DOMAPI.domTokenList, int) => string

Parameters

WebAPI.DOMAPI.domTokenList int

Return type

string

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. Read more on MDN

let remove: (WebAPI.DOMAPI.domTokenList, string) => unit

Parameters

WebAPI.DOMAPI.domTokenList string

Return type

unit

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. Read more on MDN

let replace: (
WebAPI.DOMAPI.domTokenList,
~token: string,
~newToken: string,
) => bool

Parameters

WebAPI.DOMAPI.domTokenList string string

Return type

bool

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. Read more on MDN

let supports: (WebAPI.DOMAPI.domTokenList, string) => bool

Parameters

WebAPI.DOMAPI.domTokenList string

Return type

bool

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. Read more on MDN

let toggle: (
WebAPI.DOMAPI.domTokenList,
~token: string,
~force: bool=?,
) => bool

Parameters

WebAPI.DOMAPI.domTokenList string option< bool >

Return type

bool