1<!DOCTYPE html>
2<html>
3<head>
4<script src="../../js/resources/js-test-pre.js"></script>
5<script>
6if (window.internals)
7 internals.settings.setDialogElementEnabled(true);
8</script>
9</head>
10<body>
11<dialog id="mydialog">It's my dialog.</dialog>
12<script>
13description("Tests that showModal() performs the steps specified in the HTML spec. bug 97425");
14
15dialog = document.getElementById('mydialog');
16computedStyle = window.getComputedStyle(dialog, null);
17shouldBe("computedStyle.getPropertyValue('display')", "'none'");
18
19dialog.showModal();
20computedStyle = window.getComputedStyle(dialog, null);
21shouldBe("computedStyle.getPropertyValue('display')", "'block'");
22
23// The quoted text in the comments below are from <http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#dom-dialog-showmodal>.
24// "If dialog already has an open attribute, then throw an InvalidStateError exception."
25shouldThrow('dialog.showModal();', "'Error: INVALID_STATE_ERR: DOM Exception 11'");
26
27dialog.close();
28shouldBe("computedStyle.getPropertyValue('display')", "'none'");
29
30dialog.parentNode.removeChild(dialog);
31// "If dialog is not in a Document, then throw an InvalidStateError exception."
32shouldThrow('dialog.showModal();', "'Error: INVALID_STATE_ERR: DOM Exception 11'");
33</script>
34<script src="../../js/resources/js-test-post.js"></script>
35</body>
36</html>