CSSPropertyRule: initialValue プロパティ

Limited availability

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

initialValueCSSPropertyRule インターフェイスの読み取り専用プロパティで、 null にすることができます。 @property ルールで表されるカスタムプロパティ登録の初期値を返し、プロパティの初期値を制御します。

文字列で、 CSS Syntax 3 で定義されている <declaration-value> です。

このスタイルシートには、単一の @property ルールが格納されています。最初に返される CSSRule は、このルールを表す CSSPropertyRule となります。 initialValue プロパティは、文字列 "#c0ffee" を返します。これは、 CSS の initial-value プロパティの値です。

css
@property --property-name {
  syntax: "<color>";
  inherits: false;
  initial-value: #c0ffee;
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].initialValue); //the string "#c0ffee"

仕様書

Specification
CSS Properties and Values API Level 1
# dom-csspropertyrule-initialvalue

ブラウザーの互換性

BCD tables only load in the browser