StylePropertyMapReadOnly: size 属性
size 是 StylePropertyMapReadOnly 接口的一个只读属性,它返回一个无符号长整型整数,表示 StylePropertyMapReadOnly 对象的大小。
值
无符号长整型。
示例
在这里,我们使用 size 属性返回按钮元素的 computedStyleMap 中的总条目数。
js
// grab our element
const 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 map
const amountStyles = allComputedStyles.size;
console.log(amountStyles); // logs 338
规范
| 规范 |
|---|
| CSS 类型化 OM Level 1 # dom-stylepropertymapreadonly-size |
浏览器兼容性
加载中…