StylePropertyMapReadOnly.keys()

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The StylePropertyMapReadOnly.keys() method returns a new array iterator containing the keys for each item in StylePropertyMapReadOnly

Syntax

StylePropertyMapReadOnly.keys()

Parameters

None.

Return value

A new Array.

Example

In this example we use the keys() method to be able to access the properties within our 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

No specification found

No specification data found for api.StylePropertyMapReadOnly.keys.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
keys
66
79
No
No
53
No
66
66
No
47
No
9.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/StylePropertyMapReadOnly/keys