summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-remove.html
blob: c2350c304249dcb9478e62725936275ec0fda383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!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">
<link rel=help href="https://fullscreen.spec.whatwg.org/#removing-steps">
<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>