StylePropertyMapReadOnly: size property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thesize read-only property of theStylePropertyMapReadOnly interface returns an unsigned long integercontaining the size of theStylePropertyMapReadOnly object.
In this article
Value
An unsigned long integer.
Examples
Here we use the size property to return the total entries within the button elementscomputedStyleMap.
js
// grab our elementconst buttonEl = document.querySelector("button");// we can retrieve all computed styles with `computedStyleMap`const allComputedStyles = buttonEl.computedStyleMap();// use size to get the total styles within the mapconst amountStyles = allComputedStyles.size;console.log(amountStyles); // logs 338Specifications
| Specification |
|---|
| CSS Typed OM Level 1> # dom-stylepropertymapreadonly-size> |