remove-single.html (1159B)
1 <!DOCTYPE html> 2 <title>Remove the single element on the fullscreen element stack</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testdriver.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <script src="../trusted-click.js"></script> 8 <div id="log"></div> 9 <div id="single"></div> 10 <script> 11 promise_test(async (t) => { 12 t.add_cleanup(() => { 13 if (document.fullscreenElement) { 14 return document.exitFullscreen(); 15 } 16 }); 17 const single = document.getElementById("single"); 18 const [, event] = await Promise.all([ 19 trusted_request(single), 20 fullScreenChange(), 21 ]); 22 23 assert_equals(document.fullscreenElement, single); 24 assert_equals(event.target, single); 25 single.remove(); 26 // Because /single/ was removed from the top layer, the fullscreen 27 // element becomes null synchronously. 28 assert_equals(document.fullscreenElement, null); 29 30 const secondEvent = await fullScreenChange(); 31 assert_equals(document.fullscreenElement, null); 32 assert_equals(event.target, single); 33 }); 34 </script>