get-animations.html (1029B)
1 <!doctype html> 2 <title>getAnimations depending on container query</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#animated-containers"> 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 width: 100px; 11 } 12 #div { color: red; } 13 @keyframes test { 14 from { color: green; } 15 to { color: green; } 16 } 17 @container (min-width: 200px) { 18 #div { animation: test 1s linear forwards; } 19 } 20 </style> 21 <div id=container> 22 <div id=div>Green</div> 23 </div> 24 <script> 25 setup(() => assert_implements_size_container_queries()); 26 27 test(() => { 28 assert_equals(getComputedStyle(div).color, 'rgb(255, 0, 0)'); 29 30 container.style = 'width:300px'; 31 assert_equals(div.getAnimations().length, 1); 32 assert_equals(getComputedStyle(div).color, 'rgb(0, 128, 0)'); 33 }, 'Calling getAnimations updates layout of parent frame if needed'); 34 </script>