4 <title>CSS Parser - auto-close for unexpected EOF
</title>
5 <script src=
"../../resources/testharness.js"></script>
6 <script src=
"../../resources/testharnessreport.js"></script>
13 <div id=
"qs"><i class=
"x"></i><b></b></div>
15 var sheet
= document
.styleSheets
[0];
16 var rules
= sheet
.cssRules
;
20 rules
[0].style
.cssText
= "width: 200px; color: rgb(10, 20, 30";
21 assert_equals(rules
[0].style
.width
, "200px", "Width not set correctly.");
22 assert_equals(rules
[0].style
.color
, "rgb(10, 20, 30)", "Color not set correctly");
23 }, "Unexpected EOF - CSSStyleDeclaration.cssText missing ')'");
27 rules
[0].style
.color
= "rgba(0, 0, 0, 0.2";
28 assert_equals(rules
[0].style
.color
, "rgba(0, 0, 0, 0.2)", "rgba value not set correctly");
29 }, "Unexpected EOF - CSSStyleDeclaration.color missing ')'");
33 rules
[0].selectorText
= "#x, [name=\"x";
34 assert_equals(rules
[0].selectorText
, "#x, [name=\"x\"]");
35 }, "Unexpected EOF - CSSStyleRule.selectorText missing ']'");
39 sheet
.insertRule("span { color: green", 2);
40 assert_equals(rules
[2].cssText
, "span { color: green; }");
41 }, "Unexpected EOF - CSSStyleSheet.insertRule missing '}'");
45 assert_equals(document
.querySelector("#qs [class=x").tagName
, "I");
46 }, "Unexpected EOF - querySelector missing ']'");
50 assert_equals(document
.querySelector("#qs :nth-child(2").tagName
, "B");
51 }, "Unexpected EOF - querySelector missing ')'");