tor-browser

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

host-dom-001.html (807B)


      1 <!doctype html>
      2 <title>CSS Test: :host in DOM APIs</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/#host-selector">
      7 <div id="host"></div>
      8 <script>
      9 test(function() {
     10  let root = host.attachShadow({ mode: "open" });
     11  root.innerHTML = `<div></div>`;
     12  assert_false(host.matches(":host"), ":host shouldn't match from CSSOM from outside the shadow tree");
     13  assert_true(root.firstElementChild.matches(":host div"), ":host should match from within the shadow tree");
     14  assert_equals(root.querySelector(":host div"), root.firstElementChild, ":host should match from within the shadow tree");
     15 })
     16 </script>