blob: e2725d95e1cc01da8fd4b7113089767891440776 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<style id="style-container">
</style>
</head>
<body>
</body>
<script>
description('Test the parsing of :is(selectorList) for querySelector and style.');
function testInvalidSelector(selectorString) {
shouldThrowErrorName('document.querySelector(":is(' + selectorString + ')")', 'SyntaxError');
var styleContainer = document.getElementById('style-container');
styleContainer.innerHTML = ':is(' + selectorString + ') { }';
shouldBe("document.getElementById('style-container').sheet.cssRules.length", "0");
styleContainer.innerHTML = '';
}
var invalidSelectors = [
// Not selectors.
"",
" ",
",",
".123class",
"#123id",
"[]",
"()",
")",
"{}",
"}",
// Unbalanced parenthesized functional pseudo classes.
":not(",
":is(",
":nth-child(2n+1 of",
];
debug("1 invalid selectors");
for (var i = 0; i < invalidSelectors.length; ++i) {
var selectorString = invalidSelectors[i];
testInvalidSelector(selectorString);
}
</script>
<script src="../../resources/js-test-post.js"></script>
</html>