dialog-showModal-remove.html (979B)
1 <!doctype html> 2 <title>dialog element: removing from document after showModal()</title> 3 <link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal"> 4 <link rel=help href="https://fullscreen.spec.whatwg.org/#removing-steps"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <dialog></dialog> 8 <script> 9 async_test(t => { 10 const dialog = document.querySelector('dialog') 11 dialog.showModal() 12 assert_true(dialog.open) 13 // The dialog element is now in top layer. Removing it should synchronously 14 // remove it from top layer, but should leave it in a strange limbo state. 15 dialog.addEventListener('close', t.unreached_func('close event')) 16 dialog.remove() 17 assert_true(dialog.open) 18 // if an event was queued, it would fire before this timeout 19 step_timeout(t.step_func_done(() => { 20 assert_true(dialog.open) 21 // pass if no close event was fired 22 })) 23 }) 24 </script>