The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList or HTMLAreaElement.relList. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive.
This interface doesn't inherit any property.
DOMTokenList.length Read only
integer representing the number of objects stored in the object.This interface doesn't inherit any method.
DOMTokenList.item()DOMTokenList.contains()true if the underlying string contains token, otherwise false
DOMTokenList.add()DOMTokenList.remove()DOMTokenList.replace()DOMTokenList.supports()true if a given token is in the associated attribute's supported tokens.DOMTokenList.toggle()DOMTokenList.entries()iterator allowing to go through all key/value pairs contained in this object.DOMTokenList.forEach()DOMTokenList element.DOMTokenList.keys()iterator allowing to go through all keys of the key/value pairs contained in this object.DOMTokenList.values()iterator allowing to go through all values of the key/value pairs contained in this object.| Specification | Status | Comment |
|---|---|---|
| DOM The definition of 'DOMTokenList' in that specification. | Living Standard | Initial definition |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | 10 | (Yes) | (Yes) |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|
| Basic support | ? | (Yes) | ? | ? | ? | ? | (Yes) |
DOMSettableTokenList (object that extends DOMTokenList with settable .value property)
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList