mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-10 21:28:04 +02:00
Automatic update from web-platform-tests [css-variables] Custom props with invalid var() should behave as 'unset' We currently have a (WPT-enforced) bug where custom properties that reference guaranteed-invalid values [1] behave themselves as guaranteed- invalid. This is not correct per spec, which requires the custom property to behave as 'unset' in this case. This was clarified in [2], although the spec has described this behavior long before that. Unfortunately Firefox has the same issue. Safari on the other hand, does implement it correctly. [1] https://drafts.csswg.org/css-variables/#guaranteed-invalid [2] https://github.com/w3c/csswg-drafts/issues/4075 Bug: 980930 Change-Id: I84a0da3aad6b72b574009d560eb868632769098a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108026 Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org> Cr-Commit-Position: refs/heads/master@{#751636} -- wpt-commits: fc793094912b67b45a94d101819bffb9b9307710 wpt-pr: 22318
44 lines
1.4 KiB
HTML
44 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<title>Testing substitution of guaranteed-invalid values</title>
|
|
<link rel="help" href="https://drafts.csswg.org/css-variables/#guaranteed-invalid">
|
|
<link rel="help" href="https://drafts.csswg.org/css-variables/#cycles">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
#target1 {
|
|
/* Cycle */
|
|
--var1: var(--var2);
|
|
--var2: var(--var1);
|
|
|
|
/* Reference to cycle */
|
|
--var3: var(--var1);
|
|
|
|
/* Reference to non-existent property */
|
|
--var4: var(--noexist);
|
|
}
|
|
|
|
#target1parent {
|
|
--var3: inherited;
|
|
--var4: inherited;
|
|
}
|
|
</style>
|
|
<div id="target1parent">
|
|
<div id="target1"></div>
|
|
</div>
|
|
<script>
|
|
test( function () {
|
|
let cs = getComputedStyle(target1);
|
|
assert_equals(cs.getPropertyValue('--var1'), '');
|
|
assert_equals(cs.getPropertyValue('--var2'), '');
|
|
}, 'Custom properties in a cycle are guaranteed-invalid');
|
|
|
|
test( function () {
|
|
let cs = getComputedStyle(target1);
|
|
assert_equals(cs.getPropertyValue('--var3'), ' inherited');
|
|
}, 'A custom property referencing a cycle is treated as unset');
|
|
|
|
test( function () {
|
|
let cs = getComputedStyle(target1);
|
|
assert_equals(cs.getPropertyValue('--var4'), ' inherited');
|
|
}, 'A custom property referencing a non-existent variable is treated as unset');
|
|
</script>
|