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
35 lines
986 B
HTML
35 lines
986 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="help" href="https://drafts.csswg.org/css-env-1/">
|
|
<title>Test env() will work in custom properties</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
#parent {
|
|
--var1: inherited;
|
|
}
|
|
#child {
|
|
--my-width: env(test, 100px);
|
|
width: var(--my-width);
|
|
--var1: env(nonexistent);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="parent">
|
|
<div id="child"></div>
|
|
</div>
|
|
<script>
|
|
test(() => {
|
|
const style = window.getComputedStyle(child);
|
|
assert_equals(style.getPropertyValue("width"), "100px");
|
|
}, 'env() is substituted into a custom property');
|
|
|
|
test(() => {
|
|
const style = window.getComputedStyle(child);
|
|
assert_equals(style.getPropertyValue("--var1"), " inherited");
|
|
}, 'Substitution of unrecognized env() causes unset');
|
|
</script>
|
|
</body>
|
|
</html>
|