Files
ladybird/Tests/LibWeb/Text/input/anchor-parse-nested-invalid.html
Jelle Raaijmakers 1012aad322 LibWeb: Remove bogus discard_a_token() from CSS anchor fallback parsing
This correctly rejects invalid trailing tokens from `anchor()` fallback
values. Also introduces discard_whitespace() to take care of any
whitespace between the fallback value and the closing parenthesis.
2026-04-01 19:41:46 +01:00

20 lines
692 B
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<script>
test(() => {
const el = document.createElement("div");
// No space before trailing garbage — must still be rejected.
el.style.top = "anchor(--foo top, anchor(--bar bottom)GARBAGE)";
println(`no space before garbage: ${el.style.top}`);
el.style.top = "anchor(--foo top, anchor(--bar bottom))";
println(`valid nested: ${el.style.top}`);
// Trailing whitespace after nested anchor() must be accepted.
el.style.top = "";
el.style.top = "anchor(--foo top, anchor(--bar bottom) )";
println(`trailing whitespace: ${el.style.top}`);
});
</script>