CSSStyleRule.style

style は読み取り専用プロパティで、この CSSStyleRule宣言ブロックのための CSSStyleDeclaration インターフェイスです。

CSSStyleDeclaration オブジェクトで、次のプロパティがあります。

computed flag

未設定。

declarations

このルール内で宣言された宣言で、指定された順番であり、個別指定プロパティに展開された一括指定プロパティです。

parent CSS rule

コンテキストオブジェクトで、 this の別名です。

owner node

null です。

この CSS は 1 つのスタイルルールを含んでいます。これは最初の CSSRule となり、 document.styleSheets[0].cssRules で返されます。 従って、 myRules[0].styleh1 に定義された宣言を表す CSSStyleDeclaration をを返します。

css
h1 {
  color: pink;
}
js
let myRules = document.styleSheets[0].cssRules;
console.log(myRules[0].style); // a CSSStyleDeclaration representing the declarations on the h1.

メモ: 宣言ブロックは、中括弧内に現れるスタイルルールの一部で、実際にスタイル定義を提供する部分です(セレクターについては、中括弧の前に来る部分)。

仕様書

Specification
CSS Object Model (CSSOM)
# dom-cssstylerule-style

ブラウザーの互換性

BCD tables only load in the browser