top-layer-position.html (1206B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <body> 8 <script> 9 test(() => { 10 const dialog = document.createElement('dialog'); 11 document.body.appendChild(dialog); 12 13 dialog.style = 'position:static'; 14 assert_equals(getComputedStyle(dialog).position, 'static'); 15 dialog.showModal(); 16 assert_true(dialog.open); 17 assert_equals(getComputedStyle(dialog).position, 'absolute', 18 `dialog should be position:absolute when element.style has position:static.`); 19 dialog.close(); 20 assert_false(dialog.open); 21 22 dialog.style = 'position:relative'; 23 assert_equals(getComputedStyle(dialog).position, 'relative'); 24 dialog.showModal(); 25 assert_true(dialog.open); 26 assert_equals(getComputedStyle(dialog).position, 'absolute', 27 `dialog should be position:absolute when element.style has position:relative.`); 28 dialog.close(); 29 assert_false(dialog.open); 30 }, `Verifies that position:static and position:relative computed to position:absolute in the top layer.`); 31 </script>