Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-nesting/top-level-parent-pseudo-specificity.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Nesting: Specificity of top-level '&'</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
/* Note: at the top level, '&' matches like ':root'. */
/* Should have zero specificity: */
& { color: red; }
/* Should also have zero specificity: */
:where(&) { color: green; }
</style>
<script>
test(() => {
assert_equals(getComputedStyle(document.documentElement).color, 'rgb(0, 128, 0)');
});
</script>