summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scoping/slotted-slot.html
blob: 1f4aa75ae60ec5ee5f6863aace8678584e4e6934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<title>CSS Test: ::slotted() not matching slot elements</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-scoping/#slotted-pseudo">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="host" style="color:green">This text should be green.</div>
<script>
  test(() => {
    let root = host.attachShadow({mode:"open"});
    root.innerHTML = '<div><slot id="slot"></slot><div>';
    let innerHost = root.firstChild;
    let innerRoot = innerHost.attachShadow({mode:"open"});
    innerRoot.innerHTML = "<style>::slotted(#slot){color:red}</style><slot></slot>";
    assert_equals(getComputedStyle(root.querySelector("#slot")).color, "rgb(0, 128, 0)");
  }, "Check that ::slotted does not match slot elements");
</script>