特性为 DOMTokenList interface is a stringifier that returns the value of the list as a DOMString , or clears and sets the list to the given value.

句法

tokenList.value;
					

A DOMString

范例

In the following example we retrieve the list of classes set on a <span> element as a DOMTokenList 使用 Element.classList , then write the value of the list to the <span> 's Node.textContent .

First, the HTML:

<span class="a b c"></span>
					

Now the JavaScript:

let span = document.querySelector("span");
let classes = span.classList;
span.textContent = classes.value;
					

输出看起来像这样:

规范

规范 状态 注释
DOM
The definition of 'value' in that specification.
实时标准 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
value Chrome 50 注意事项
50 注意事项
Before Chrome 50, this property was part of the deprecated child DOMSettableTokenList 接口。
Edge ≤18 Firefox Yes IE 不支持 No Opera 37 注意事项
37 注意事项
Before Opera 37, this property was part of the deprecated child DOMSettableTokenList 接口。
Safari 10 WebView Android 50 注意事项
50 注意事项
Before Chrome 50, this property was part of the deprecated child DOMSettableTokenList 接口。
Chrome Android 50 注意事项
50 注意事项
Before Chrome 50, this property was part of the deprecated child DOMSettableTokenList 接口。
Firefox Android Yes Opera Android 37 注意事项
37 注意事项
Before Opera 37, this property was part of the deprecated child DOMSettableTokenList 接口。
Safari iOS 10 Samsung Internet Android 5.0 注意事项
5.0 注意事项
Before Samsung Internet 5.0, this property was part of the deprecated child DOMSettableTokenList 接口。

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

元数据

  • 最后修改: