Skip to content

Commit f6e4773

Browse files
koffacebook-github-bot
authored andcommitted
[PR] Add a number of CSSOM interfaces + fix HTMLStyleElement.sheet type
Summary: Fixes #2943 and #2696 - CSSStyleSheet - https://www.w3.org/TR/cssom-1/#the-cssstylesheet-interface - CSSStyleRule - https://www.w3.org/TR/cssom-1/#cssstylerule - CSSMediaRule - https://www.w3.org/TR/cssom-1/#the-cssmediarule-interface - CSSConditionRule - https://developer.mozilla.org/en-US/docs/Web/API/CSSConditionRule - CSSGroupingRule - https://www.w3.org/TR/2016/WD-cssom-1-20160317/#the-cssgroupingrule-interface Pull Request resolved: #8071 Reviewed By: nmote Differential Revision: D17329043 Pulled By: mvitousek fbshipit-source-id: de76eba9201d797a44261ccb81897cf5d45cde32
1 parent cb91a56 commit f6e4773

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

lib/cssom.js

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
declare class StyleSheet {
99
disabled: boolean;
10-
href: string;
11-
media: MediaList;
12-
ownerNode: Node;
13-
parentStyleSheet: ?StyleSheet;
14-
title: string;
15-
type: string;
10+
+href: string;
11+
+media: MediaList;
12+
+ownerNode: Node;
13+
+parentStyleSheet: ?StyleSheet;
14+
+title: string;
15+
+type: string;
1616
}
1717

1818
declare class StyleSheetList {
@@ -32,17 +32,36 @@ declare class MediaList {
3232
}
3333

3434
declare class CSSStyleSheet extends StyleSheet {
35-
cssRules: CSSRuleList;
36-
ownerRule: ?CSSRule;
35+
+cssRules: CSSRuleList;
36+
+ownerRule: ?CSSRule;
37+
deleteRule(index: number): void;
38+
insertRule(rule: string, index: number): number;
39+
}
40+
41+
declare class CSSGroupingRule extends CSSRule {
42+
+cssRules: CSSRuleList;
3743
deleteRule(index: number): void;
38-
insertRule(rule: string, index: number): void;
44+
insertRule(rule: string, index: number): number;
45+
}
46+
47+
declare class CSSConditionRule extends CSSGroupingRule {
48+
conditionText: string;
49+
}
50+
51+
declare class CSSMediaRule extends CSSConditionRule {
52+
+media: MediaList;
53+
}
54+
55+
declare class CSSStyleRule extends CSSRule {
56+
selectorText: string;
57+
+style: CSSStyleDeclaration;
3958
}
4059

4160
declare class CSSRule {
4261
cssText: string;
43-
parentRule: ?CSSRule;
44-
parentStyleSheet: ?CSSStyleSheet;
45-
type: number;
62+
+parentRule: ?CSSRule;
63+
+parentStyleSheet: ?CSSStyleSheet;
64+
+type: number;
4665
static STYLE_RULE: number;
4766
static MEDIA_RULE: number;
4867
static FONT_FACE_RULE: number;

lib/dom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ declare class HTMLStyleElement extends HTMLElement {
35113511
disabled: boolean;
35123512
media: string;
35133513
scoped: boolean;
3514-
sheet: ?StyleSheet;
3514+
sheet: ?CSSStyleSheet;
35153515
type: string;
35163516
}
35173517

0 commit comments

Comments
 (0)