pending-style-changes-001.html (1247B)
1 <meta charset=utf-8> 2 <title>CSS Animations Test: requirement on pending style changes - getAnimations</title> 3 <link rel="help" href="https://drafts.csswg.org/css-animations-2/#requirements-on-pending-style-changes"> 4 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 8 <style> 9 @keyframes anim {} 10 11 .animate { 12 animation: anim 10s; 13 } 14 </style> 15 16 <div id="target"></div> 17 18 <script> 19 test (t => { 20 assert_equals(target.getAnimations().length, 0, 'Test precondition.'); 21 target.classList.add('animate'); 22 assert_equals(target.getAnimations().length, 1, 23 'target.getAnimations() should include the CSS animation after animate class added.'); 24 target.classList.remove('animate'); 25 }, 'Animatable::getAnimations() should be able to see a style-created CSS animation immediately'); 26 27 test(t => { 28 assert_equals(document.getAnimations().length, 0, 'Test precondition.'); 29 target.classList.add('animate'); 30 assert_equals(document.getAnimations().length, 1, 31 'document.getAnimations() should include the CSS animation after animate class added.'); 32 target.classList.remove('animate'); 33 }, 'Document::getAnimations() should be able to see a style-created CSS animation immediately'); 34 </script>