StylePropertyMapReadOnly: getAll()-Methode

Limited availability

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

Die getAll()-Methode der StylePropertyMapReadOnly-Schnittstelle gibt ein Array von CSSStyleValue-Objekten zurück, die die Werte für die angegebene Eigenschaft enthalten.

Syntax

js
getAll(property)

Parameter

property

Der Name der Eigenschaft, von der alle Werte abgerufen werden sollen.

Rückgabewert

Ein Array von CSSStyleValue-Objekten.

Beispiele

Das folgende Beispiel verwendet getAll() mit der background-image-Eigenschaft. Ein Array wird zurückgegeben, das ein Element für jedes deklarierte Hintergrundbild enthält.

js
// get a button element
const buttonEl = document.querySelector("button");

// we can retrieve all computed styles with `computedStyleMap`
const allComputedStyles = buttonEl.computedStyleMap();

// use getAll() with the background image property
const allBkImages = allComputedStyles.getAll("background-image");
console.log(allBkImages); // logs an array with each background image as an item

Spezifikationen

Specification
CSS Typed OM Level 1
# dom-stylepropertymapreadonly-getall

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getAll

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.