Files
ladybird/Tests/LibWeb/Text/input/css/selection-with-var-in-shorthand-crash.html
Dylan Hart 1354eb1ac2 LibWeb: Resolve var() in shorthands before pseudo-element filtering
When a shorthand like `background` containing `var()` is used in
a `::selection` rule, the shorthand was filtered out by the pseudo-
element property whitelist before variable resolution could occur.
This left PendingSubstitutionStyleValue longhands unresolved,
causing either a crash or incorrect computed values.

Allow unresolved shorthands to bypass the pseudo-element filter so
variable resolution can proceed. After resolution and expansion
into longhands, filter out any that the pseudo-element does not
support.

Fixes #8625.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 12:46:20 +01:00

19 lines
423 B
HTML

<!DOCTYPE html>
<style>
:root {
--selection-bg: lightblue;
}
::selection {
background: var(--selection-bg);
}
</style>
<p id="target">Select me</p>
<script src="../include.js"></script>
<script>
test(() => {
const target = document.getElementById("target");
const style = getComputedStyle(target, "::selection");
println(style.backgroundColor);
});
</script>