Tests: Add a test for combinators inside pseudo selectors

:host() and ::slotted() both take a `<compound-selector>` as their
argument, but we currently allow a sneaky combinator in there too, as
this demonstrates. That will be solved over subsequent commits, but
adding this now to track progress.
This commit is contained in:
Sam Atkins
2026-04-08 14:33:19 +01:00
parent c7969858d3
commit 68aa529a18
Notes: github-actions[bot] 2026-04-08 14:54:45 +00:00
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
test(() => {
function test_invalid(selector) {
let supported = CSS.supports(`selector(${selector})`);
println(`${selector} is invalid: ${supported ? 'FAIL' : 'PASS'}`);
}
test_invalid("::slotted(> a)");
test_invalid("::slotted(+ a)");
test_invalid("::slotted(~ a)");
test_invalid(":host(> a)");
test_invalid(":host(+ a)");
test_invalid(":host(~ a)");
});
</script>