Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!doctype html>
<meta charset="utf-8" />
<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" />
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/invoker-utils.js"></script>
<dialog id="invokee"></dialog>
<button id="invokerbutton" commandfor="invokee" command="show-modal"></button>
<script>
const invokee = document.getElementById('invokee');
test(
function (t) {
assert_false(invokee.open, "invokee.open");
assert_false(invokee.matches(":modal"), "invokee :modal");
let fired = false;
invokee.addEventListener('command', () => {
fired = true;
invokee.remove();
});
invokerbutton.click();
assert_true(fired, "command event fired");
assert_false(invokee.isConnected, "dialog no longer connected");
assert_false(invokee.open, "invokee.open");
assert_false(invokee.matches(":modal"), "invokee :modal");
},
`invoking a dialog and removing during command event does not raise an error`,
);
</script>