<!DOCTYPE html>
<html>
<head>
<title>CSS Parser - auto-close for unexpected EOF</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
div {}
div {}
</style>
</head>
<body>
<div id="qs"><i class="x"></i><b></b></div>
<script>
var sheet = document.styleSheets[0];
var rules = sheet.cssRules;
test(function(){
// internal_decls
rules[0].style.cssText = "width: 200px; color: rgb(10, 20, 30";
assert_equals(rules[0].style.width, "200px", "Width not set correctly.");
assert_equals(rules[0].style.color, "rgb(10, 20, 30)", "Color not set correctly");
}, "Unexpected EOF - CSSStyleDeclaration.cssText missing ')'");
test(function(){
// internal_value
rules[0].style.color = "rgba(0, 0, 0, 0.2";
assert_equals(rules[0].style.color, "rgba(0, 0, 0, 0.2)", "rgba value not set correctly");
}, "Unexpected EOF - CSSStyleDeclaration.color missing ')'");
test(function(){
// internal_selector
rules[0].selectorText = "#x, [name=\"x";
assert_equals(rules[0].selectorText, "#x, [name=\"x\"]");
}, "Unexpected EOF - CSSStyleRule.selectorText missing ']'");
test(function(){
// internal_rule
sheet.insertRule("span { color: green", 2);
assert_equals(rules[2].cssText, "span { color: green; }");
}, "Unexpected EOF - CSSStyleSheet.insertRule missing '}'");
test(function(){
// internal_selector
assert_equals(document.querySelector("#qs [class=x").tagName, "I");
}, "Unexpected EOF - querySelector missing ']'");
test(function(){
// internal_selector
assert_equals(document.querySelector("#qs :nth-child(2").tagName, "B");
}, "Unexpected EOF - querySelector missing ')'");
</script>
</body>
</html>