StylePropertyMapReadOnly.size

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

sizeStylePropertyMapReadOnly インターフェイスの読み取り専用プロパティで、 StylePropertyMapReadOnly オブジェクトの大きさを符号なし長整数で返します。

構文

js
var size = StylePropertyMapReadOnly.size;

符号なし長整数です。

ここでは size プロパティを使用して、この button 要素の computedStyleMap に含まれる項目の数を返します。

js
// 要素を取得
const buttonEl = document.querySelector("button");

// `computedStyleMap` ですべての計算済みスタイルが取得できます
const allComputedStyles = buttonEl.computedStyleMap();

// size を使用してマップ内にあるスタイルの数を取得します
const amountStyles = allComputedStyles.size;
console.log(amountStyles); // 338 と表示

仕様書

Specification
CSS Typed OM Level 1
# dom-stylepropertymapreadonly-size

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
size

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.