StylePropertyMapReadOnly: keys() method
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheStylePropertyMapReadOnly.keys() method returns a newarray iterator containing the keys for each iteminStylePropertyMapReadOnly
In this article
Syntax
js
keys()Parameters
None.
Return value
A newArray.
Examples
In this example we use thekeys() method to be able to access theproperties within ourElement.computedStyleMap().
js
// get a button elementconst buttonEl = document.querySelector("button");// we can retrieve all computed styles with `computedStyleMap`const allComputedStyles = buttonEl.computedStyleMap();// keys returns an iterable list of propertiesconst props = allComputedStyles.keys();console.log(props.next().value); // returns align-content