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-variables/revert-rule-to-var.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Custom Properties: Using revert-rule to revert to a var()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#target {
--green: green;
color: var(--green);
}
#target {
color: red;
color: revert-rule;
}
</style>
<div id=target>
</div>
<script>
test((x) => {
assert_true(CSS.supports('color:revert-rule'));
assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
}, 'Using revert-rule to revert to a value containing var()');
</script>