StylePropertyMapReadOnly: values()-Methode
Eingeschränkt verfügbar
Diese Funktion ist nicht Baseline, da sie in einigen der am weitesten verbreiteten Browser nicht funktioniert.
Want more browser support for this feature? Tell us why.
Die StylePropertyMapReadOnly.values()-Methode gibt einen neuen Array-Iterator zurück, der die Werte für jeden Index im StylePropertyMapReadOnly-Objekt enthält.
Syntax
js
values()
Parameter
Keine.
Rückgabewert
Ein neues Array.
Beispiele
In diesem Beispiel verwenden wir die values()-Methode, um auf die Werte im Element.computedStyleMap() zugreifen zu können.
js
// get a button element
const buttonEl = document.querySelector("button");
// we can retrieve all computed styles with `computedStyleMap`
const allComputedStyles = buttonEl.computedStyleMap();
// values returns an iterable list of the CSS values
const vals = allComputedStyles.values();
console.log(vals.next().value); // returns a CSSStyleValue
Spezifikationen
| Spezifikation |
|---|
| CSS Typed OM Level 1> # stylepropertymapreadonly> |