StylePropertyMapReadOnly: keys() method
Baseline 2026>
Newly available
Since November 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Want more browser support for this feature? Tell us why.
Note: This feature is available in Web Workers.
The StylePropertyMapReadOnly.keys() method returns a new array iterator containing the keys for each item in StylePropertyMapReadOnly.
Syntax
js
keys()
Parameters
None.
Return value
A new Array.
Examples
>Basic usage
In this example, we use the keys() method to access the properties within the Element.computedStyleMap().
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
Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # stylepropertymapreadonly> |