W3cubDocs

/Web APIs

StylePropertyMapReadOnly: values() method

The StylePropertyMapReadOnly.values() method returns a new array iterator containing the values for each index in the StylePropertyMapReadOnly object.

Syntax

js

values()

Parameters

None.

Return value

A new Array.

Examples

In this example we use the values() method to be able to access the values within our Element.computedStyleMap().

js

// get a button element
const buttonEl = document.querySelector("button");

// we can retrieve all computed styles with `computedStyleMap`
const allComputedStyles = buttonEl.computedStyleMap();

// values returns an iterable list of the CSS values
const vals = allComputedStyles.values();
console.log(vals.next().value); // returns a CSSStyleValue

Specifications

No specification found

No specification data found for api.StylePropertyMapReadOnly.values.
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
values 66 79 No No 53 16.4 66 66 No 47 16.4 9.0

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