summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display-none.tentative.html
blob: 8db022b1262f84ff6e570d13ce0bf14fbcdd5d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests that a popover can be anchored to an unrendered element.</title>
<link rel=author href="mailto:xiaochengh@chromium.org">
<link rel=help href="https://open-ui.org/components/popover.research.explainer">
<link rel=help href="https://html.spec.whatwg.org/multipage/popover.html">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id=popover popover anchor=anchor></div>
<div id=anchor></div>

<style>
  #anchor {
    display: none;
  }
  [popover] {
    inset: auto;
    background: lime;
    padding: 0;
    border: 0;
    width: 100px;
    height: 100px;
    top: anchor(top, 100px);
    left: anchor(left, 100px);
  }
</style>

<script>
test(() => {
  popover.showPopover();
  assert_equals(popover.offsetLeft, 100);
  assert_equals(popover.offsetTop, 100);
});
</script>