<!DOCTYPE html>
<title>@container: scroll-state(stuck) matching for initial rendering</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-rule">
<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>
#filler {
height: 10000px;
}
#stuck {
container-name: initially-stuck;
container-type: scroll-state;
position: sticky;
bottom: 0;
}
@container initially-stuck scroll-state(stuck: bottom) {
span { --stuck: yes }
}
</style>
<div id="filler"></div>
<div id="stuck">
<span id="target">My container is stuck</span>
</div>
<script>
setup(() => assert_implements_container_queries());
promise_test(async t => {
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--stuck"), "yes");
}, "Check that scroll-state(stuck: bottom) matches");
</script>