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 |
瀏覽器相容性
載入中…