CSSPropertyRule: syntax プロパティ

Limited availability

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

syntaxCSSPropertyRule インターフェイスの読み取り専用プロパティで、 これは、 @property ルールによって表されるカスタムプロパティ登録のリテラル構文を返し、プロパティの値が計算値の時点でどのように解釈されるかを制御するものです。

文字列です。

このスタイルシートには、単一の @property ルールが格納されています。最初に返される CSSRule は、このルールを表す CSSPropertyRule となります。 syntax プロパティはリテラル文字列の "<color>" を返します。

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

仕様書

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

ブラウザーの互換性

BCD tables only load in the browser