popover-removal.html (1033B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <title>Popover document removal behavior</title> 4 <link rel="author" href="mailto:masonf@chromium.org"> 5 <link rel=help href="https://open-ui.org/components/popover.research.explainer"> 6 <link rel=help href="https://html.spec.whatwg.org/multipage/popover.html"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <div popover id=popover>Popover</div> 11 12 <script> 13 promise_test(async t => { 14 function loadCompleted() { 15 return new Promise(resolve => { 16 window.addEventListener('load', resolve); 17 }); 18 } 19 const popover = document.querySelector('[popover]'); 20 assert_false(popover.matches(':popover-open')); 21 popover.showPopover(); 22 assert_true(popover.matches(':popover-open')); 23 popover.remove(); // Shouldn't cause any issues 24 document.body.click(); // Shouldn't cause light dismiss problems 25 await loadCompleted(); // The document should finish loading 26 }, 'Removal from the document shouldn\'t cause issues'); 27 28 </script>