Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-properties-values-api/registered-property-dependency-through-fallback.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Properties and Values API: registered color custom property referenced via var() fallback</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@property --registered-color {
syntax: "<color>";
inherits: false;
initial-value: #0000;
}
div {
--registered-color: blue;
--registered-color-ref: var(--registered-color-override, var(--registered-color));
background-image: linear-gradient(var(--registered-color-ref));
}
</style>
<div id="plain"></div>
<div id="prioritary" style="color-scheme: unset"></div>
<script>
const EXPECTED = "linear-gradient(rgb(0, 0, 255))";
test(() => {
assert_equals(getComputedStyle(document.getElementById("plain")).backgroundImage, EXPECTED);
}, "registered color resolves through a var() fallback");
test(() => {
assert_equals(getComputedStyle(document.getElementById("prioritary")).backgroundImage, EXPECTED);
}, "registered color resolves through a var() fallback when a prioritary property forces early resolution");
</script>