popover-implicit-anchor.html (1290B)
1 <!DOCTYPE html> 2 <title>Popover invokers form an implicit anchor reference</title> 3 <link rel="author" href="mailto:masonf@chromium.org"> 4 <link rel="help" href="https://www.w3.org/TR/css-anchor-position-1/#implicit"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-actions.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/html/semantics/popovers/resources/popover-utils.js"></script> 11 12 <button id=button popovertarget=popover>Button</button> 13 <div popover id=popover>Popover</div> 14 15 <style> 16 #button { 17 position:relative; 18 top:100px; 19 left:100px; 20 } 21 #popover { 22 border:1px solid black; 23 inset: auto; 24 margin:0; 25 padding:0; 26 position-area: top left; 27 } 28 body { margin: 0; } 29 </style> 30 31 <script> 32 promise_test(async (t) => { 33 assert_false(popover.matches(':popover-open')); 34 await clickOn(button); 35 assert_true(popover.matches(':popover-open')); 36 // Popover should be anchored to the button. 37 assert_equals(popover.offsetLeft + popover.offsetWidth, button.offsetLeft); 38 assert_equals(popover.offsetTop + popover.offsetHeight, button.offsetTop); 39 }, 'Popover invokers form an implicit anchor reference'); 40 </script>