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/slotted-link.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Scoping: ::slotted :link</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="host"><a id="a" href="#notvisited">This link should be green.</a></div>
<script>
let root = host.attachShadow({mode:"open"});
root.innerHTML = `
<style>
::slotted(:link) { color:green }
::slotted(:visited) { color:red }
</style>
<slot></slot>`;
test(() => {
assert_equals(getComputedStyle(a).color, "rgb(0, 128, 0)", "Unvisited link should be green.");
}, "Check that we match :link and not :visited for slotted anchor.");
</script>