Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-scoping/scope-pseudo-in-shadow.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>:scope pseudo does not match in shadow root</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="host"></div>
<script>
test(() => {
host.attachShadow({mode: 'open'}).innerHTML = `
<style>
div {
background-color: green;
}
:scope div {
background-color: red;
}
:scope > div {
background-color: red;
}
</style>
<div>Test</div>
`;
let div = host.shadowRoot.querySelector('div');
assert_equals(getComputedStyle(div).backgroundColor, 'rgb(0, 128, 0)');
}, ':scope does not match in shadow root');
</script>