Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

StylePropertyMapReadOnly: values()-Methode

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

This feature does not appear to be defined in any specification.

Browser-Kompatibilität