このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

CSSRule: parentStyleSheet プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

parentStyleSheetCSSRule インターフェイスのプロパティで、現在のルールを定義している StyleSheet オブジェクトを返します。

StyleSheet オブジェクトです。

js
const docRules = document.styleSheets[0].cssRules;
console.log(docRules[0].parentStyleSheet == document.styleSheets[0]); // returns true

仕様書

Specification
CSS Object Model (CSSOM)
# dom-cssrule-parentstylesheet

ブラウザーの互換性