-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathscroll-state-scrollable-pseudo.html
More file actions
60 lines (57 loc) · 1.7 KB
/
scroll-state-scrollable-pseudo.html
File metadata and controls
60 lines (57 loc) · 1.7 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
<!DOCTYPE html>
<title>@container: scroll-state(scrollable) for pseudo element</title>
<link rel="help" href="https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-conditional-5/#scrollable">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<script src="/css/css-transitions/support/helper.js"></script>
<style>
#scroller {
container-type: scroll-state;
overflow: auto;
width: 100px;
height: 100px;
}
#wrapper {
width: 10px;
height: 10px;
}
#wrapper.large {
width: 75px;
height: 75px;
}
#target {
width: 200%;
height: 200%;
--before: no;
--after: no;
@container scroll-state(scrollable) {
&::before {
--before: yes;
content: " ";
}
&::after {
--after: yes;
}
}
}
</style>
<div id="scroller">
<div id="wrapper">
<div id="target"></div>
</div>
</div>
<script>
setup(() => assert_implements_scroll_state_container_queries());
promise_test(async t => {
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target, "::before").getPropertyValue("--before"), "no");
assert_equals(getComputedStyle(target, "::after").getPropertyValue("--after"), "no");
}, "::before/::after initially not matching");
promise_test(async t => {
wrapper.className = "large";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target, "::before").getPropertyValue("--before"), "yes");
assert_equals(getComputedStyle(target, "::after").getPropertyValue("--after"), "yes");
}, "::before/::after matching after content starts scrollable #scroller");
</script>