tor-browser

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

moveBefore-shadow-root.html (792B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 
      5 <body>
      6  <div id=shadowTarget></div>
      7 </body>
      8 
      9 <script>
     10 test(() => {
     11  shadowTarget.attachShadow({mode: 'open'});
     12  const child1 = document.createElement('p');
     13  child1.textContent = 'Child1';
     14  const child2 = document.createElement('p');
     15  child2.textContent = 'Child2';
     16 
     17  shadowTarget.shadowRoot.append(child1, child2);
     18  shadowTarget.shadowRoot.moveBefore(child2, child1);
     19  assert_equals(shadowTarget.shadowRoot.firstChild, child2, "Original lastChild is now firstChild");
     20  assert_equals(shadowTarget.shadowRoot.lastChild, child1, "Original firstChild is now lastChild");
     21 }, "moveBefore() is allowed in ShadowRoots (i.e., connected DocumentFragments)");
     22 </script>