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-open-2.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=author href="mailto:falken@chromium.org">
<link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<dialog id=mydialog>It's my dialog.</dialog>
<script>
test(() => {
const dialog = document.getElementById('mydialog');
let computedStyle = window.getComputedStyle(dialog, null);
assert_equals(computedStyle.getPropertyValue('display'), 'none');
dialog.show();
computedStyle = window.getComputedStyle(dialog, null);
assert_equals(computedStyle.getPropertyValue('display'), 'block');
dialog.close();
computedStyle = window.getComputedStyle(dialog, null);
assert_equals(computedStyle.getPropertyValue('display'), 'none');
dialog.close();
}, "Tests that dialog is visible after show() is called and not visible after close() is called.");
</script>