Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/interactive-elements/the-dialog-element/dialog-showModal-remove.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>dialog element: removing from document after showModal()</title>
<link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<dialog></dialog>
<script>
async_test(t => {
const dialog = document.querySelector('dialog')
dialog.showModal()
assert_true(dialog.open)
// The dialog element is now in top layer. Removing it should synchronously
// remove it from top layer, but should leave it in a strange limbo state.
dialog.addEventListener('close', t.unreached_func('close event'))
dialog.remove()
assert_true(dialog.open)
// if an event was queued, it would fire before this timeout
step_timeout(t.step_func_done(() => {
assert_true(dialog.open)
// pass if no close event was fired
}))
})
</script>