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-values/if-initial-unregistered.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Values and Units Test: Explicitly testing for the initial value of a custom property</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div>
PASS if green
</div>
<style>
div {
color: if(style(--x:initial): green; else: red);
}
</style>
<script>
test(() => {
let cs = getComputedStyle(document.querySelector('div'));
assert_equals(cs.getPropertyValue('color'), 'rgb(0, 128, 0)');
}, 'if-testing the initial keyword without any property registrations');
</script>