blob: d182e8047be24dbefe85cebf0d15fa5814569626 [file] [log] [blame]
<html>
<head id="head">
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("This tests parsing and re-serialization of :lang CSS selector with string arguments");
function parseThenSerializeRule(rule)
{
var styleElement = document.getElementById("style");
var head = document.getElementById("head");
if (styleElement)
head.removeChild(styleElement);
styleElement = document.createElement("style");
styleElement.id = "style";
var head = document.getElementById("head");
head.appendChild(styleElement);
styleElement.appendChild(document.createTextNode(rule));
return styleElement.sheet.cssRules[0].cssText;
}
function testSelectorRoundTrip(selector)
{
shouldBe("parseThenSerializeRule('" + selector + " { }')", "'" + selector + " { }'");
}
testSelectorRoundTrip(':lang("a")');
testSelectorRoundTrip(':lang("bb", cc)');
testSelectorRoundTrip(':lang("ddd", eee)');
testSelectorRoundTrip(':lang("ddd", eee, ffff)');
testSelectorRoundTrip(':lang("ddd", eee, "ffff")');
testSelectorRoundTrip(':lang("*-1997")');
testSelectorRoundTrip(':lang("*-1997", "*-1998")');
testSelectorRoundTrip(':lang("*-1997", "*-1998", "*-1999")');
testSelectorRoundTrip(':lang("")');
debug('');
shouldBe("parseThenSerializeRule(':lang(foo, \"bar\", baz) { }')", "':lang(foo, \"bar\", baz) { }'");
shouldBe("parseThenSerializeRule(':lang(foo, \"bar\" , baz) { }')", "':lang(foo, \"bar\", baz) { }'");
shouldBe("parseThenSerializeRule(':lang( foo , \"bar\" , baz ) { }')", "':lang(foo, \"bar\", baz) { }'");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>