StylePropertyMapReadOnly: Methode keys()
Eingeschränkt verfügbar
Diese Funktion ist nicht Baseline, da sie in einigen der am weitesten verbreiteten Browser nicht funktioniert.
Want more support for this feature? Tell us why.
Die StylePropertyMapReadOnly.keys()-Methode gibt einen neuen
Array-Iterator zurück, der die Schlüssel für jedes Element in StylePropertyMapReadOnly enthält.
Syntax
js
keys()
Parameter
Keine.
Rückgabewert
Ein neues Array.
Beispiele
In diesem Beispiel verwenden wir die keys()-Methode, um auf die
Eigenschaften innerhalb unseres 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();
// keys returns an iterable list of properties
const props = allComputedStyles.keys();
console.log(props.next().value); // returns align-content
Spezifikationen
| Spezifikation |
|---|
| CSS Typed OM Level 1> # stylepropertymapreadonly> |