CSS Typed Object Model API
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
Basic usage
In this example, we use the keys() method to access the properties within the Element.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
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
