tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

slotted-matches.html (889B)


      1 <!doctype html>
      2 <title>CSS Test: ::slotted() should not match via the matches() API, since it's in the wrong scope</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      6 <link rel="help" href="https://drafts.csswg.org/css-scoping/#slotted-pseudo">
      7 <link rel="help" href="https://dom.spec.whatwg.org/#dom-element-matches">
      8 <link rel="help" href="https://bugzil.la/1544242">
      9 <div id="host"><div id="slotted"></div></div>
     10 <script>
     11 test(function() {
     12  let slotted = document.getElementById("slotted");
     13  host.attachShadow({ mode: "open" }).innerHTML = `<slot></slot>`;
     14  assert_false(slotted.matches("::slotted(div)"), "Shouldn't match ::slotted from the outer tree")
     15 }, "::slotted() doesn't reveal the presence of shadow DOM via matches()");
     16 </script>