DomTokenList Class

https://dom.spec.whatwg.org/#interface-domtokenlist

Implements

Properties

NameDescription
CountGets the number of tokens in the list.
LengthGets the number of tokens in the list.
ValueGets or sets the value of the associated attribute, as a string.

Gets the number of tokens in the list.

public int Count { get; }

Property value

int

Gets the number of tokens in the list.

public uint Length { get; }

Gets or sets the value of the associated attribute, as a string.

public string Value { get; set; }

Indexers

NameDescription
this[int]Gets the token at the given index.
this[uint]Gets the token at the given index, or null when the index is out of range.

ItemAt overloads

Gets the token at the given index.

public string this[int index] { get; }
Parameters
index int
Property value

string

this[uint]

DomTokenList.cs

Gets the token at the given index, or null when the index is out of range.

public string? this[uint index] { get; }

Methods

NameDescription
Add(IReadOnlyList<string>)Adds the given tokens to the list, ignoring those already present.
Contains(string)Returns whether the list contains the given token.
GetEnumerator()Returns an enumerator that iterates through the collection.
Item(uint)Returns the token at the given index, or null when the index is out of range.
Remove(IReadOnlyList<string>)Removes the given tokens from the list.
Replace(string, string)https://dom.spec.whatwg.org/#dom-domtokenlist-replace
Supports(string)https://dom.spec.whatwg.org/#dom-domtokenlist-supports
System.Collections.Generic.IReadOnlyList<System.String>.get_Item(int)
System.Collections.IEnumerable.GetEnumerator()
ToString()Returns a string that represents the current object.
Toggle(string, bool?)https://dom.spec.whatwg.org/#dom-domtokenlist-toggle

Add(IReadOnlyList<string>)

DomTokenList.cs

Adds the given tokens to the list, ignoring those already present.

public void Add(params IReadOnlyList<string> tokens)

Contains(string)

DomTokenList.cs

Returns whether the list contains the given token.

public bool Contains(string token)

GetEnumerator()

DomTokenList.cs

Returns an enumerator that iterates through the collection.

public IEnumerator<string> GetEnumerator()

Returns

IEnumerator<string> An enumerator that can be used to iterate through the collection.

See also

Item(uint)

DomTokenList.cs

Returns the token at the given index, or null when the index is out of range.

public string? Item(uint index)

Remove(IReadOnlyList<string>)

DomTokenList.cs

Removes the given tokens from the list.

public void Remove(params IReadOnlyList<string> tokens)

Replace(string, string)

DomTokenList.cs

https://dom.spec.whatwg.org/#dom-domtokenlist-replace

public bool Replace(string token, string newToken)

Supports(string)

DomTokenList.cs

https://dom.spec.whatwg.org/#dom-domtokenlist-supports

public bool Supports(string token)

System.Collections.Generic.IReadOnlyList<System.String>.get_Item(int)

string IReadOnlyList<string>.get_Item(int index)

Parameters

index int

Returns

string

No documentation is available.

System.Collections.IEnumerable.GetEnumerator()

DomTokenList.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

ToString()

DomTokenList.cs

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.

Toggle(string, bool?)

DomTokenList.cs

https://dom.spec.whatwg.org/#dom-domtokenlist-toggle

public bool Toggle(string token, bool? force = null)