tor-browser

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

classname-query-after-sibling-adoption.html (1331B)


      1 <!-- quirks mode -->
      2 <html>
      3  <head>
      4    <title>Quirks mode elements with class names should remain queriable regardless of sibling adoption into standards mode documents</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7  </head>
      8  <body>
      9    <div>
     10      <button class="Foo"></button>
     11      <button class="Foo"></button>
     12    </div>
     13    <template><div class="Bar"></div></template>
     14    <script>
     15    test(function () {
     16      var templateDocument = document.querySelector("template").content.ownerDocument;
     17      assert_equals(templateDocument.compatMode, "CSS1Compat");
     18      assert_equals(document.compatMode, "BackCompat");
     19      var container = document.querySelector("div");
     20      var button1 = container.querySelector(".foo");
     21      assert_true(button1 instanceof Element);
     22      templateDocument.appendChild(button1);
     23      assert_true(templateDocument.querySelector(".Foo") instanceof Element);
     24      assert_false(templateDocument.querySelector(".foo") instanceof Element);
     25      var button2byHierarchy = container.firstElementChild;
     26      var button2bySelector = container.querySelector(".foo");
     27      assert_true(button2bySelector instanceof Element);
     28      assert_equals(button2bySelector, button2byHierarchy);
     29    });
     30    </script>
     31  </body>
     32 </html>