Table of Contents

Class DOMTokenList

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by ClassList or RelList, and many others.

[Value("DOMTokenList")]
public class DOMTokenList
Inheritance
DOMTokenList
Inherited Members

Remarks

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

See also on MDN

Constructors

DOMTokenList()

public DOMTokenList()

Properties

this[int]

public string this[int i] { get; set; }

Parameters

i int

Property Value

string

Length

The read-only length property of the DOMTokenList interface is an integer representing the number
of objects stored in the object.

[Value("length")]
public ulong Length { get; }

Property Value

ulong

An positive integer, or 0 if the list is empty.

Remarks

Value

The value property of the DOMTokenList
interface is a stringifier that returns the value of the list serialized as a
string, or clears and sets the list to the given value.

[Value("value")]
public string Value { get; set; }

Property Value

string

A string representing the serialized content of the list.
Each item is separated by a space.

Remarks

Methods

Add(params string[])

The add() method of the DOMTokenList interface adds the given tokens to the list, omitting any that are already present.

[Value("add")]
public GlobalObject.Undefined Add(params string[] tokens)

Parameters

tokens string[]

Returns

GlobalObject.Undefined

None.

Remarks

Contains(string)

The contains() method of the DOMTokenList interface
returns a boolean value — true if the underlying list contains the given token,
otherwise false.

[Value("contains")]
public bool Contains(string token)

Parameters

token string

Returns

bool

A boolean value, which is true if the calling list contains
token, otherwise false.

Remarks

Remove(params string[])

The remove() method of the DOMTokenList interface
removes the specified tokens from the list.

[Value("remove")]
public GlobalObject.Undefined Remove(params string[] tokens)

Parameters

tokens string[]

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Replace(string, string)

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.

[Value("replace")]
public bool Replace(string token, string newToken)

Parameters

token string
newToken string

Returns

bool

A boolean value, which is true if oldToken was
successfully replaced, or false if not.

Remarks

Supports(string)

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.

[Value("supports")]
public bool Supports(string token)

Parameters

token string

Returns

bool

A boolean value indicating whether the token was found.

Remarks

Toggle(string, 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.

[Value("toggle")]
public bool Toggle(string token, bool force = false)

Parameters

token string
force bool

Returns

bool

A boolean value, true or false, indicating whether token is in the
list after the call or not.

Remarks