OLD | NEW |
1 Test CSSSupportRule. | 1 Test CSSSupportRule. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 PASS CSSRule.SUPPORTS_RULE is defined. | 6 PASS CSSRule.SUPPORTS_RULE is defined. |
7 rules = document.styleSheets[1].cssRules | 7 rules = document.styleSheets[1].cssRules |
8 PASS rules.length is 4 | 8 PASS rules.length is 4 |
| 9 PASS rules[0] is an instance of CSSSupportsRule |
9 PASS rules[0].type is CSSRule.SUPPORTS_RULE | 10 PASS rules[0].type is CSSRule.SUPPORTS_RULE |
10 PASS rules[0].cssRules.length is 2 | 11 PASS rules[0].cssRules.length is 2 |
11 PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE | 12 PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE |
| 13 PASS rules[0].cssRules[1] is an instance of CSSSupportsRule |
12 PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE | 14 PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE |
13 PASS rules[0].cssRules[1].cssRules.length is 1 | 15 PASS rules[0].cssRules[1].cssRules.length is 1 |
14 PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE | 16 PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE |
15 PASS rules[0].conditionText is "(width: 0)" | 17 PASS rules[0].conditionText is "(width: 0)" |
16 PASS rules[0].cssText is "@supports (width: 0) {\n s { width: 0px; }\n @suppor
ts (width: 1) {\n s { color: rgb(0, 0, 0); }\n}\n}" | 18 PASS rules[0].cssText is "@supports (width: 0) {\n s { width: 0px; }\n @suppor
ts (width: 1) {\n s { color: rgb(0, 0, 0); }\n}\n}" |
17 | 19 |
18 Inserting and deleting rules. | 20 Inserting and deleting rules. |
19 rules[0].insertRule('@media all { #s { width: 0px; } }', 2) | 21 rules[0].insertRule('@media all { #s { width: 0px; } }', 2) |
20 PASS rules[0].cssRules.length is 3 | 22 PASS rules[0].cssRules.length is 3 |
21 PASS rules[0].cssRules[2].type is CSSRule.MEDIA_RULE | 23 PASS rules[0].cssRules[2].type is CSSRule.MEDIA_RULE |
22 rules[0].deleteRule(2) | 24 rules[0].deleteRule(2) |
23 PASS rules[0].cssRules.length is 2 | 25 PASS rules[0].cssRules.length is 2 |
24 rules[0].cssRules[1].insertRule('@supports (display: rainbow) {}', 1) | 26 rules[0].cssRules[1].insertRule('@supports (display: rainbow) {}', 1) |
25 PASS rules[0].cssRules[1].cssRules.length is 2 | 27 PASS rules[0].cssRules[1].cssRules.length is 2 |
| 28 PASS rules[0].cssRules[1].cssRules[1] is an instance of CSSSupportsRule |
26 PASS rules[0].cssRules[1].cssRules[1].type is CSSRule.SUPPORTS_RULE | 29 PASS rules[0].cssRules[1].cssRules[1].type is CSSRule.SUPPORTS_RULE |
27 rules[0].cssRules[1].deleteRule(1) | 30 rules[0].cssRules[1].deleteRule(1) |
28 PASS rules[0].cssRules.length is 2 | 31 PASS rules[0].cssRules.length is 2 |
29 | 32 |
30 @charset, @namespace, @import rules are not allowed inside @supports. | 33 @charset, @namespace, @import rules are not allowed inside @supports. |
31 PASS rules[0].insertRule('@charset "UTF-8"', 2) threw exception SyntaxError: Fai
led to execute 'insertRule' on 'CSSSupportsRule': the rule '@charset "UTF-8"' is
invalid and cannot be parsed.. | 34 PASS rules[0].insertRule('@charset "UTF-8"', 2) threw exception SyntaxError: Fai
led to execute 'insertRule' on 'CSSSupportsRule': the rule '@charset "UTF-8"' is
invalid and cannot be parsed.. |
32 PASS rules[0].insertRule('@namespace ""', 2) threw exception SyntaxError: Failed
to execute 'insertRule' on 'CSSSupportsRule': the rule '@namespace ""' is inval
id and cannot be parsed.. | 35 PASS rules[0].insertRule('@namespace ""', 2) threw exception SyntaxError: Failed
to execute 'insertRule' on 'CSSSupportsRule': the rule '@namespace ""' is inval
id and cannot be parsed.. |
33 PASS rules[0].insertRule('@import url("../fast/cssom/resources/import.css")', 2)
threw exception HierarchyRequestError: Failed to execute 'insertRule' on 'CSSSu
pportsRule': '@import' rules cannot be inserted inside a group rule.. | 36 PASS rules[0].insertRule('@import url("../fast/cssom/resources/import.css")', 2)
threw exception HierarchyRequestError: Failed to execute 'insertRule' on 'CSSSu
pportsRule': '@import' rules cannot be inserted inside a group rule.. |
34 | 37 |
35 Whitespace and formatting should be preserved within the condition, whitespace o
utside the condition should be trimmed. | 38 Whitespace and formatting should be preserved within the condition, whitespace o
utside the condition should be trimmed. |
36 PASS rules[1].conditionText is "(( ( padding: 0) and (display: none)) or
(display: rainbow))" | 39 PASS rules[1].conditionText is "(( ( padding: 0) and (display: none)) or
(display: rainbow))" |
37 | 40 |
38 @supports rule nested inside a media rule. | 41 @supports rule nested inside a media rule. |
39 PASS rules[2].type is CSSRule.MEDIA_RULE | 42 PASS rules[2].type is CSSRule.MEDIA_RULE |
40 PASS rules[2].cssRules.length is 1 | 43 PASS rules[2].cssRules.length is 1 |
| 44 PASS rules[2].cssRules[0] is an instance of CSSSupportsRule |
41 PASS rules[2].cssRules[0].type is CSSRule.SUPPORTS_RULE | 45 PASS rules[2].cssRules[0].type is CSSRule.SUPPORTS_RULE |
42 PASS rules[2].cssRules[0].conditionText is "( padding: 0)" | 46 PASS rules[2].cssRules[0].conditionText is "( padding: 0)" |
43 PASS rules[0].cssRules[1].cssRules.length is 1 | 47 PASS rules[0].cssRules[1].cssRules.length is 1 |
44 PASS rules[2].cssRules[0].cssRules[0].type is CSSRule.PAGE_RULE | 48 PASS rules[2].cssRules[0].cssRules[0].type is CSSRule.PAGE_RULE |
45 PASS rules[2].cssText is "@media all { \n @supports ( padding: 0) {\n @page :l
eft { top: 0px; }\n}\n}" | 49 PASS rules[2].cssText is "@media all { \n @supports ( padding: 0) {\n @page :l
eft { top: 0px; }\n}\n}" |
46 | 50 |
47 No extra parens should be added to the conditionText. | 51 No extra parens should be added to the conditionText. |
48 PASS rules[3].conditionText is "(border: black) and (padding: 0) and (width: 0)" | 52 PASS rules[3].conditionText is "(border: black) and (padding: 0) and (width: 0)" |
49 | 53 |
50 Deleting a top-level rule should work correctly. | 54 Deleting a top-level rule should work correctly. |
51 document.styleSheets[1].deleteRule(3) | 55 document.styleSheets[1].deleteRule(3) |
52 PASS rules.length is 3 | 56 PASS rules.length is 3 |
53 PASS rules[0].type is CSSRule.SUPPORTS_RULE | 57 PASS rules[0].type is CSSRule.SUPPORTS_RULE |
54 PASS rules[0].cssRules.length is 2 | 58 PASS rules[0].cssRules.length is 2 |
55 PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE | 59 PASS rules[0].cssRules[0].type is CSSRule.STYLE_RULE |
56 PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE | 60 PASS rules[0].cssRules[1].type is CSSRule.SUPPORTS_RULE |
57 PASS rules[0].cssRules[1].cssRules.length is 1 | 61 PASS rules[0].cssRules[1].cssRules.length is 1 |
58 PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE | 62 PASS rules[0].cssRules[1].cssRules[0].type is CSSRule.STYLE_RULE |
59 PASS successfullyParsed is true | 63 PASS successfullyParsed is true |
60 | 64 |
61 TEST COMPLETE | 65 TEST COMPLETE |
62 | 66 |
OLD | NEW |