Skip to content

Commit 88b961b

Browse files
ziransunmoz-wptsync-bot
authored andcommitted
Don't share style for cousins that are using Container Queries.
Differential Revision: https://phabricator.services.mozilla.com/D164224 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1804677 gecko-commit: ef6f715d594de27fe56ad4b3de3f7a5830f3b2d9 gecko-reviewers: emilio
1 parent 09345e9 commit 88b961b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!doctype html>
2+
<title>CSS Container Queries Test: Check style is not sharing between cousins in the case of Container Queries</title>
3+
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script src="support/cq-testcommon.js"></script>
7+
<style>
8+
.float {
9+
float: left;
10+
width: 25px;
11+
height: 25px;
12+
}
13+
.item {
14+
container-type: inline-size;
15+
height: 25px;
16+
}
17+
@container (width >= 50px) {
18+
.item div { color: lime; }
19+
}
20+
@container (width >= 150px) {
21+
.item div { color: green; }
22+
}
23+
</style>
24+
<div style="width: 150px">
25+
<div class="float"></div>
26+
<div class="item">
27+
<div id="target1"></div>
28+
</div>
29+
<div class="item">
30+
<div id="target2"></div>
31+
</div>
32+
</div>
33+
<script>
34+
setup(() => assert_implements_container_queries());
35+
36+
test(() => {
37+
assert_equals(getComputedStyle(target1).color, "rgb(0, 255, 0)", "Second item container should be 100px wide");
38+
assert_equals(getComputedStyle(target2).color, "rgb(0, 128, 0)", "First item container should be 200px wide");
39+
}, "Check that style is not sharing in the case of Container Queries");
40+
</script>

0 commit comments

Comments
 (0)