-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathanchor-center-visibility-change.html
More file actions
89 lines (79 loc) · 2 KB
/
anchor-center-visibility-change.html
File metadata and controls
89 lines (79 loc) · 2 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html class=reftest-wait>
<title>Tests 'anchor-center' value when target visibility changes (by changing 'display', 'visibility', or popover trigger)</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center">
<link rel="author" href="mailto:plampe@igalia.com">
<link rel="author" href="mailto:kiet.ho@apple.com">
<link rel="match" href="anchor-center-visibility-change-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<style>
.container {
width: 100px;
height: 100px;
border: solid 3px;
position: relative;
margin: 50px;
}
.anchor {
anchor-name: --anchor;
position: relative;
width: 50px;
height: 50px;
left: 40px;
top: 5px;
background: lime;
}
.target {
position-anchor: --anchor;
position: absolute;
}
.target-inner {
width: 30px;
height: 20px;
}
#target-1 {
justify-self: anchor-center;
background: cyan;
display: none;
}
#target-2 {
align-self: anchor-center;
background: blue;
visibility: hidden;
}
#target-3 {
align-self: anchor-center;
justify-self: anchor-center;
background: magenta;
/* Override default popover style */
margin: 0;
padding: 0;
border: none;
}
</style>
<div class="container">
<div class="anchor"></div>
<div id="target-1" class="target">
<div class="target-inner"></div>
</div>
<div id="target-2" class="target">
<div class="target-inner"></div>
</div>
<div id="target-3" class="target" popover>
<div class="target-inner"></div>
</div>
</div>
<script>
// Targets should be invisible initially.
waitForAtLeastOneFrame().then(() => {
// Change targets to be visible.
document.getElementById('target-1').style.display = 'flow';
document.getElementById('target-2').style.visibility = 'visible';
document.getElementById('target-3').showPopover();
waitForAtLeastOneFrame().then(() => {
// Targets should be visible now.
takeScreenshot();
});
});
</script>