reattach-container-with-dirty-child.html (1207B)
1 <!doctype html> 2 <title>CSS Container Queries Test: @container changing display type while descendant styles change</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#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 #container { 9 container-type: inline-size; 10 } 11 @container (min-width: 200px) { 12 div { color: red } 13 } 14 @container (max-width: 150px) { 15 div { color: lime } 16 } 17 </style> 18 <div id="container"> 19 <div id="child"><span id="inner">XXX</span></div> 20 </div> 21 <script> 22 setup(() => assert_implements_size_container_queries()); 23 24 test(() => { 25 container.offsetTop; 26 assert_equals(getComputedStyle(child).color, "rgb(255, 0, 0)"); 27 }, "Initially wider than 200px"); 28 29 test(() => { 30 container.style.width = "100px"; 31 container.style.display = "inline-block"; 32 inner.style.color = "green"; 33 container.offsetTop; 34 assert_equals(getComputedStyle(child).color, "rgb(0, 255, 0)"); 35 assert_equals(getComputedStyle(inner).color, "rgb(0, 128, 0)"); 36 }, "Container query changed and inner.style applied"); 37 </script>