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
Section titled “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
Section titled “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
Section titled “Public Functions Documentation”function item
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “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
Section titled “function toggle”boolean toggle( DOMString token)function replace
Section titled “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
Section titled “function supports”boolean supports( DOMString token)not implemented
Public Attributes Documentation
Section titled “Public Attributes Documentation”variable length
Section titled “variable length”readonly attribute unsigned long length;length of the list
variable value
Section titled “variable value”stringifier attribute DOMString value;string with all tokens space separated
© 2026 Coherent Labs. All rights reserved.