remove-parent.html (1169B)
1 <!DOCTYPE html> 2 <title>Remove the parent of the fullscreen element</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> 10 <div id="child"></div> 11 </div> 12 <script> 13 promise_test(async (t) => { 14 t.add_cleanup(() => { 15 if (document.fullscreenElement) { 16 return document.exitFullscreen(); 17 } 18 }); 19 const child = document.getElementById("child"); 20 const [, event] = await Promise.all([ 21 trusted_request(child), 22 fullScreenChange(), 23 ]); 24 assert_equals(document.fullscreenElement, child); 25 assert_equals(event.target, child); 26 child.parentNode.remove(); 27 // Because /child/ was removed from the top layer, the fullscreen 28 // element becomes null synchronously. 29 assert_equals(document.fullscreenElement, null); 30 const secondEvent = await fullScreenChange(); 31 assert_equals(document.fullscreenElement, null); 32 assert_equals(secondEvent.target, document); 33 }); 34 </script>