tor-browser

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

quirks-mode-import.html (1024B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Importing quirks mode element into standards mode document</title>
      5    <link rel="help" href="https://crbug.com/416619318">
      6    <style>
      7       div { color: green; }
      8       :not(.Foo) { color: red; }
      9    </style>
     10    <script src="/resources/testharness.js"></script>
     11    <script src="/resources/testharnessreport.js"></script>
     12  </head>
     13  <div id="elem1" class="Foo">This text should be green</div>
     14  <div id="container"></div>
     15  <script>
     16    test(() => {
     17      let doc = (new DOMParser()).parseFromString('<div><div id="elem2" class="Foo">This text should be green</div></div>', 'text/html');
     18      let subdiv = doc.documentElement.firstChild.nextSibling.firstChild;
     19      document.querySelector('#container').appendChild(document.importNode(subdiv, true));
     20 
     21      assert_equals(getComputedStyle(document.querySelector('#elem1')).color, 'rgb(0, 128, 0)');
     22      assert_equals(getComputedStyle(document.querySelector('#elem2')).color, 'rgb(0, 128, 0)');
     23    });
     24  </script>
     25 </html>