tor-browser

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

file_fullscreen-shadowdom.html (1710B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <!--
      4  https://bugzilla.mozilla.org/show_bug.cgi?id=1430305
      5  Bug 1430305 - Implement ShadowRoot.fullscreenElement
      6  -->
      7  <head>
      8    <title>Bug 1430305</title>
      9    <script src="/tests/SimpleTest/SimpleTest.js">
     10    </script>
     11    <script src="/tests/SimpleTest/EventUtils.js">
     12    </script>
     13    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     14  </head>
     15  <body>
     16    <a target="_blank"
     17       href="https://bugzilla.mozilla.org/show_bug.cgi?id=1430305">
     18      Mozilla Bug 1430305</a>
     19 
     20    <div id="host"></div>
     21 
     22    <pre id="test">
     23      <script type="application/javascript">
     24 
     25        function begin() {
     26          var host = document.getElementById("host");
     27          var shadowRoot = host.attachShadow({mode: "open"});
     28          shadowRoot.innerHTML = "<div>test</div>";
     29          var elem = shadowRoot.firstChild;
     30          var gotFullscreenEvent = false;
     31 
     32          document.addEventListener("fullscreenchange", function () {
     33            if (document.fullscreenElement === host) {
     34              is(shadowRoot.fullscreenElement, elem,
     35                 "Expected element entered fullsceen");
     36              gotFullscreenEvent = true;
     37              document.exitFullscreen();
     38            } else {
     39              opener.ok(gotFullscreenEvent, "Entered fullscreen as expected");
     40              is(shadowRoot.fullscreenElement, null,
     41                 "Shouldn't have fullscreenElement anymore.");
     42              is(document.fullscreenElement, null,
     43                 "Shouldn't have fullscreenElement anymore.");
     44              opener.nextTest();
     45            }
     46          });
     47          elem.requestFullscreen();
     48        }
     49      </script>
     50    </pre>
     51  </body>
     52 </html>