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.
Constructors
DOMTokenList()
public DOMTokenList()
Properties
this[int]
public string this[int i] { get; set; }
Parameters
iint
Property Value
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
0if 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
tokensstring[]
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
tokenstring
Returns
- bool
A boolean value, which is
trueif the calling list containstoken, otherwisefalse.
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
tokensstring[]
Returns
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
Returns
- bool
A boolean value, which is
trueifoldTokenwas
successfully replaced, orfalseif 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
tokenstring
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
Returns
- bool
A boolean value,
trueorfalse, indicating whethertokenis in the
list after the call or not.