Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<title>@container: multiple scroll-state containers - comma separated queries</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<style>
#combined {
container-type: inline-size scroll-state;
overflow: scroll;
width: 200px;
height: 200px;
}
#outer {
container: --container / scroll-state;
overflow: scroll;
width: 400px;
height: 400px;
}
#inner {
container-type: scroll-state;
width: 200px;
height: 600px;
}
#target {
--match: no;
--match-combined: no;
}
@container scroll-state(overflowing), --container scroll-state(overflowing) {
#target { --match: yes; }
}
@container scroll-state(overflowing) {
#target { --match: no-way; }
}
@container scroll-state((overflowing:right) and (overflowing:bottom)),
(inline-size) and scroll-state((overflowing:right) and (overflowing:bottom)) {
#target { --match-combined: yes; }
}
@container scroll-state((overflowing:right) and (overflowing:bottom)) {
#target { --match-combined: no-way; }
}
</style>
<div id="combined">
<div id="outer">
<div id="inner">
<div id="target"></div>
</div>
</div>
</div>
<script>
setup(() => {
assert_implements_scroll_state_container_queries();
assert_implements_size_container_queries();
});
test(() => {
assert_equals(getComputedStyle(target).getPropertyValue("--match"), "yes");
}, "Should match the named outer container for scroll-state(overflowing)");
test(() => {
assert_equals(getComputedStyle(target).getPropertyValue("--match-combined"), "yes");
}, "Match the #combined outer container which is also a size container");
</script>