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