DOMTokenList: toString()-Methode
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Die toString()
-Methode des DOMTokenList
-Interfaces gibt die Werte der Token-Liste als String serialisiert zurück. Der Rückgabewert ist eine durch Leerzeichen getrennte Liste von Tokens, die der DOMTokenList.value
-Eigenschaft entspricht.
Syntax
js
toString()
Parameter
Keine.
Rückgabewert
Ein String.
Beispiele
js
const element = document.createElement("div");
const classes = element.classList;
element.className = "shop empty-cart";
classes.add("logged-in", "dark-mode");
console.log(classes.toString());
// "shop empty-cart logged-in dark-mode"
Spezifikationen
Specification |
---|
DOM # DOMTokenList-stringification-behavior |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
toString |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.