summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialogs-with-no-backdrop.html
blob: fec4ba85874e898bd5f4ffc698b5881513346217 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<link rel="match" href="dialogs-with-no-backdrop-ref.html">
<link rel="help" href="https://fullscreen.spec.whatwg.org/#new-stacking-layer">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-dialog-element">
<style>
dialog::backdrop {
    position: absolute;
    top: 100px;
    left: 100px;
    height: 100px;
    width: 100px;
    background: red;
}

#display-none-backdrop::backdrop {
    display: none;
}
</style>
<body>
Test that ::backdrop is not shown for non-open or non-modal dialogs.
The test passes if there is no red shown.
<dialog id="never-opened-dialog"></dialog>
<dialog id="display-none-dialog" style="display: none"></dialog>
<dialog id="non-modal-dialog" style="visibility: hidden"></dialog>
<dialog id="display-none-backdrop" style="visibility: hidden"></dialog>
<dialog id="closed-dialog"></dialog>
<dialog id="removed-dialog"></dialog>
<script>
document.getElementById('display-none-dialog').showModal();
document.getElementById('non-modal-dialog').show();
document.getElementById('display-none-backdrop').showModal();

var closedDialog = document.getElementById('closed-dialog');
closedDialog.showModal();
closedDialog.close();

var removedDialog = document.getElementById('removed-dialog');
removedDialog.showModal();
removedDialog.parentNode.removeChild(removedDialog);
</script>
</body>