1
0
Fork 0
firefox/testing/web-platform/tests/css/css-conditional/container-queries/reattach-container-with-dirty-child.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

37 lines
1.2 KiB
HTML

<!doctype html>
<title>CSS Container Queries Test: @container changing display type while descendant styles change</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#size-container">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
#container {
container-type: inline-size;
}
@container (min-width: 200px) {
div { color: red }
}
@container (max-width: 150px) {
div { color: lime }
}
</style>
<div id="container">
<div id="child"><span id="inner">XXX</span></div>
</div>
<script>
setup(() => assert_implements_size_container_queries());
test(() => {
container.offsetTop;
assert_equals(getComputedStyle(child).color, "rgb(255, 0, 0)");
}, "Initially wider than 200px");
test(() => {
container.style.width = "100px";
container.style.display = "inline-block";
inner.style.color = "green";
container.offsetTop;
assert_equals(getComputedStyle(child).color, "rgb(0, 255, 0)");
assert_equals(getComputedStyle(inner).color, "rgb(0, 128, 0)");
}, "Container query changed and inner.style applied");
</script>