keyframes-001.html (1147B)
1 <!doctype html> 2 <title>CSS Test: @keyframes applies in the shadow tree.</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 6 <link rel="help" href="https://drafts.csswg.org/css-scoping/#selectors-data-model"> 7 8 <style> 9 #in-document { 10 width: 100px; 11 height: 100px; 12 background: blue; 13 animation: myanim 10s infinite; 14 } 15 </style> 16 <div id="host"><div id="in-document"></div></div> 17 <script> 18 test(function() { 19 host.attachShadow({ mode: "open" }).innerHTML = ` 20 <style> 21 @keyframes myanim { 22 from { background: red; } 23 to { background: green; } 24 } 25 #in-shadow { 26 width: 100px; 27 height: 100px; 28 background: blue; 29 animation: myanim 10s infinite; 30 } 31 </style> 32 <slot></slot> 33 <div id="in-shadow"></div> 34 `; 35 36 assert_equals(document.getElementById('in-document').getAnimations().length, 0); 37 assert_equals(host.shadowRoot.getElementById('in-shadow').getAnimations().length, 1); 38 }, "@keyframes applies in the shadow tree") 39 </script>