Commit 846973d 1 parent 8637137 commit 846973d Copy full SHA for 846973d
File tree 1 file changed +14
-21
lines changed
files/zh-cn/web/api/cssrule/parentstylesheet
1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- title : CSSRule. parentStyleSheet
2
+ title : CSSRule: parentStyleSheet 属性
3
3
slug : Web/API/CSSRule/parentStyleSheet
4
+ l10n :
5
+ sourceCommit : 53b1989260054e651bcf001bacee9b843b8ca9c8
4
6
---
5
7
6
8
{{ APIRef("CSSOM") }}
7
9
8
- ### 概述
10
+ {{domxref("CSSRule")}} 接口的 ** ` parentStyleSheet ` ** 属性返回定义当前规则的 {{domxref("StyleSheet")}} 对象。
9
11
10
- ** parentStyleSheet ** 返回在当前规则中已定义的样式表对象。
12
+ ## 值
11
13
12
- ### 语法
14
+ {{domxref("StyleSheet")}} 对象。
13
15
14
- ``` plain
15
- stylesheet = cssRule.parentStyleSheet
16
- ```
17
-
18
- ### 参数
19
-
20
- - ` stylesheet ` 是一个样式表对象。
21
-
22
- ### 例子
16
+ ## 示例
23
17
24
- ``` plain
25
- if ( bgRule.parentStyleSheet != mySheet ) {
26
- // alien style rule!
27
- }
18
+ ``` js
19
+ const docRules = document .styleSheets [0 ].cssRules ;
20
+ console .log (docRules[0 ].parentStyleSheet == document .styleSheets [0 ]); // 返回 true
28
21
```
29
22
30
- ### 备注
23
+ ## 规范
31
24
32
- 查看 [ Gecko DOM Reference : event #DOM_styleSheet_Object ] ( en/Gecko_DOM_Reference/event#DOM_styleSheet_Object ) 有关样式表的对象接口的详细信息。
25
+ {{Specifications}}
33
26
34
- ### 规范
27
+ ## 浏览器兼容性
35
28
36
- DOM Level 2 Style - cssRule
29
+ {{Compat}}
You can’t perform that action at this time.
0 commit comments