hide-other-popover-side-effects.html (993B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://chromium-review.googlesource.com/c/chromium/src/+/4094463/8/third_party/blink/renderer/core/html/html_element.cc#1404"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <div id=popover1 popover=auto>popover1</div> 8 <div id=popover2 popover=auto>popover2</div> 9 10 <script> 11 test(() => { 12 const popover2 = document.getElementById('popover2'); 13 popover1.showPopover(); 14 popover1.addEventListener('beforetoggle', () => { 15 popover2.remove(); 16 }); 17 assert_throws_dom('InvalidStateError', () => popover2.showPopover(), 18 "popover1's beforetoggle event handler removes popover2 so showPopover should throw."); 19 assert_false(popover2.matches(':popover-open'), 'popover2 should not match :popover-open once it is closed.'); 20 }, 'Removing a popover while it is opening and force closing another popover should throw an exception.'); 21 </script>