DOMTokenList
Module: JavaScript DOM API
The DOMTokenList of the element. Currently it is only supported in the context of class list.
#include <DOMTokenList.idl>
Public Functions
Name | |
---|---|
getter DOMString | item(unsigned long index) getter for a token from the list |
boolean | contains(DOMString token) checks whether the list contains token |
void | add(DOMString tokens) adds tokens to the list |
void | remove(DOMString tokens) removes tokens from the list |
boolean | toggle(DOMString token, optional MaybeBool force) toggles a token from the list |
void | replace(DOMString token, DOMString newToken) replaces token with newToken |
boolean | supports(DOMString token) not imlemented for class list |
Public Attributes
Name | |
---|---|
readonly attribute unsigned long | length length of the list |
stringifier attribute DOMString | value string with all tokens space separated |
Public Functions Documentation
function item
getter DOMString item(
unsigned long index
)
getter for a token from the list
Parameters:
- index of the token in the list
Return: string of the token name at position index or empty token if the index is out of range
function contains
boolean contains(
DOMString token
)
checks whether the list contains token
Parameters:
- token
Return: true if the token is in the list false otherwise
function add
void add(
DOMString tokens
)
adds tokens to the list
Parameters:
- tokens to be added (currently only single token can be added)
function remove
void remove(
DOMString tokens
)
removes tokens from the list
Parameters:
- tokens to be removed (currently only single token can be removed)
function toggle
boolean toggle(
DOMString token,
optional MaybeBool force
)
toggles a token from the list
Parameters:
- token to be toggled
- force if true adds token otherwise removes token
Return: true if the token was added otherwise false
function replace
void replace(
DOMString token,
DOMString newToken
)
replaces token with newToken
Parameters:
- token to be replaced
- newToken the token to replace token with
function supports
boolean supports(
DOMString token
)
not imlemented for class list
Public Attributes Documentation
variable length
readonly attribute unsigned long length;
length of the list
variable value
stringifier attribute DOMString value;
string with all tokens space separated