DOMTokenListPart
Module: JavaScript DOM API
Separate class from DOMTokenList to avoid virtualization and slowing down common operations (adding and removing classes), because of uncommon ones (part)
#include <DOMTokenListPart.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, boolean force) toggles a token from the list |
boolean | toggle(DOMString token) |
void | replace(DOMString token, DOMString newToken) replaces token with newToken |
boolean | supports(DOMString token) not implemented |
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,
boolean 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 toggle
boolean toggle(
DOMString token
)
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 implemented
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