ladybird/Tests/LibWeb/Text/input/css/custom-properties-from-all-layers.html
Andreas Kling 95bd0602ba LibWeb: Keep custom properties from all cascade layers
Before this change, we were cascading custom properties for each layer,
and then replacing any previously cascaded properties for the element
with only the set from this latest layer.

The patch fixes the issue by making each pass of the custom property
cascade add to the same set, and then finally assigning that set of
properties to the element.
2024-09-07 12:37:15 +02:00

23 lines
616 B
HTML

<style>
:root { --top: 1px; }
@layer foo { :root { --left: 2px; } }
@layer bar { :root { --bottom: 3px; } }
@layer baz { :root { --right: 4px; } }
#testDiv {
padding-top: var(--top, 0);
padding-left: var(--left, 0);
padding-bottom: var(--bottom, 0);
padding-right: var(--right, 0);
}
</style><div id="testDiv"></div>
<script src="../include.js"></script>
<script>
test(() => {
const s = getComputedStyle(testDiv);
println(s.paddingTop);
println(s.paddingLeft);
println(s.paddingBottom);
println(s.paddingRight);
testDiv.remove();
});
</script>