此页面由社区从英文翻译而来。了解更多并加入 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月.

CSSRule 接口的 parentStyleSheet 属性返回定义当前规则的 StyleSheet 对象。

StyleSheet 对象。

示例

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

规范

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

浏览器兼容性