OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>CSS Parser - auto-close for unexpected EOF</title> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <style> |
| 8 div {} |
| 9 div {} |
| 10 </style> |
| 11 </head> |
| 12 <body> |
| 13 <div id="qs"><i class="x"></i><b></b></div> |
| 14 <script> |
| 15 var sheet = document.styleSheets[0]; |
| 16 var rules = sheet.cssRules; |
| 17 |
| 18 test(function(){ |
| 19 // internal_decls |
| 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 co
rrectly"); |
| 23 }, "Unexpected EOF - CSSStyleDeclaration.cssText missing ')'"); |
| 24 |
| 25 test(function(){ |
| 26 // internal_value |
| 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 no
t set correctly"); |
| 29 }, "Unexpected EOF - CSSStyleDeclaration.color missing ')'"); |
| 30 |
| 31 test(function(){ |
| 32 // internal_selector |
| 33 rules[0].selectorText = "#x, [name=\"x"; |
| 34 assert_equals(rules[0].selectorText, "#x, [name=\"x\"]"); |
| 35 }, "Unexpected EOF - CSSStyleRule.selectorText missing ']'"); |
| 36 |
| 37 test(function(){ |
| 38 // internal_rule |
| 39 sheet.insertRule("span { color: green", 2); |
| 40 assert_equals(rules[2].cssText, "span { color: green; }"); |
| 41 }, "Unexpected EOF - CSSStyleSheet.insertRule missing '}'"); |
| 42 |
| 43 test(function(){ |
| 44 // internal_selector |
| 45 assert_equals(document.querySelector("#qs [class=x").tagName, "I"); |
| 46 }, "Unexpected EOF - querySelector missing ']'"); |
| 47 |
| 48 test(function(){ |
| 49 // internal_selector |
| 50 assert_equals(document.querySelector("#qs :nth-child(2").tagName, "B"); |
| 51 }, "Unexpected EOF - querySelector missing ')'"); |
| 52 </script> |
| 53 </body> |
| 54 </html> |
OLD | NEW |