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 September 2015.

概述

parentStyleSheet 返回在当前规则中已定义的样式表对象。

语法

stylesheet = cssRule.parentStyleSheet

参数

  • stylesheet是一个样式表对象。

例子

if ( bgRule.parentStyleSheet != mySheet ) {
   // alien style rule!
}

备注

查看 Gecko DOM Reference:event#DOM_styleSheet_Object 有关样式表的对象接口的详细信息。

规范

DOM Level 2 Style - cssRule