Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/cssom/getComputedStyle-root.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSSOM: :root selector parsed in getComputedStyle()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
:root {
--a: red;
}
</style>
<script>
"use strict";
test(() => {
const a = getComputedStyle(document.documentElement).getPropertyValue("--a");
assert_equals(a, "red");
}, "Accessing variables in :root pseudo-selector");
</script>