Name

DOMSettableTokenList — a token list with a settable string value

Inherits from

DOMTokenList

Synopsis

A DOMSettableTokenList is a DOMTokenList that also has a value property that can be set to specify the entire set of tokens at once.

The classList property of Element is a DOMTokenList that represents the set of tokens in the className property, which is a string. If you want to set all the classList tokens at once, you can simply set the className property to a new string. The sandbox property of the IFrame element is a little different. This property and the HTML attribute that it is based on was defined by HTML5 and so there is no need for an old string representation and a new DOMTokenList representation. In this case, the property is simply defined as a DOMSettableTokenList: you can read it and write it as if it were a string, or you can use its methods and use it as a set of tokens. The htmlFor property of Output and the audio property of Video are also DOMSettableTokenLists.

Properties

string value

The space-separated string representation of the set of tokens. You can read or write this property to treat the set as a single string value. You do not normally need to use this property explicitly, however: when you use a DOMSettableTokenList as a string, it is this string value that is returned. And if you assign a string to a DOMSettableTokenList, this property is implicitly set.

Get JavaScript: The Definitive Guide, 6th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.