Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>Popover invokers form an implicit anchor reference</title>
<link rel="author" href="mailto:masonf@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/html/semantics/popovers/resources/popover-utils.js"></script>
<button id=button popovertarget=popover>Button</button>
<div popover id=popover>Popover</div>
<style>
#button {
position:relative;
top:100px;
left:100px;
}
#popover {
border:1px solid black;
inset: auto;
margin:0;
padding:0;
position-area: top left;
}
body { margin: 0; }
</style>
<script>
promise_test(async (t) => {
assert_false(popover.matches(':popover-open'));
await clickOn(button);
assert_true(popover.matches(':popover-open'));
// Popover should be anchored to the button.
assert_equals(popover.offsetLeft + popover.offsetWidth, 100);
assert_equals(popover.offsetTop + popover.offsetHeight, 100);
}, 'Popover invokers form an implicit anchor reference');
</script>