CSSPropertyRule: name プロパティ

Limited availability

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

nameCSSPropertyRule インターフェイスの読み取り専用プロパティで、これはプロパティ名を表します。これは @property ルールの前置き部分においてカスタムプロパティに指定された名前をシリアライズしたものです。

文字列です。

このスタイルシートには、単一の @property ルールが格納されています。最初に返される CSSRule は、このルールを表す CSSPropertyRule となります。 name プロパティは文字列 "--property-name" を返します。この文字列は、 CSS でカスタムプロパティに指定された名前です。

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

仕様書

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

ブラウザーの互換性

BCD tables only load in the browser