web api instance method
StylePropertyMapReadOnly: keys() method
The StylePropertyMapReadOnly.keys() method returns a new
array iterator containing the keys for each item
in StylePropertyMapReadOnly
Syntax
keys()
Parameters
None.
Return value
A new Array.
Examples
In this example we use the keys() method to be able to access the
properties within our computedStyleMap().
// 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
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.