tor-browser

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

popover-document-open.html (1412B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <link rel="author" href="mailto:masonf@chromium.org">
      4 <link rel=help href="https://open-ui.org/components/popover.research.explainer">
      5 <link rel=help href="https://html.spec.whatwg.org/multipage/popover.html">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <div popover id=popover1>Popover</div>
     10 
     11 <script>
     12  window.onload = () => {
     13    test((t) => {
     14      const popover1 = document.querySelector('#popover1');
     15      popover1.showPopover();
     16      assert_true(popover1.matches(':popover-open'));
     17      assert_true(!document.querySelector('#popover2'));
     18      document.open();
     19      document.write('<!DOCTYPE html><div popover id=popover2>Popover</div>');
     20      document.close();
     21      assert_true(!document.querySelector('#popover1'),'popover1 should be removed from the document');
     22      assert_true(!!document.querySelector('#popover2'),'popover2 should be in the document');
     23      assert_false(popover1.matches(':popover-open'),'popover1 should have been hidden when it was removed from the document');
     24      assert_false(popover1.matches(':popover-open'),'popover2 shouldn\'t be showing yet');
     25      popover2.showPopover();
     26      assert_true(popover2.matches(':popover-open'),'popover2 should be able to be shown');
     27      popover2.hidePopover();
     28    },'document.open should not break popovers');
     29  };
     30 </script>