begin-attribute-mutation.html (955B)
1 <!DOCTYPE html> 2 <title>Mutating the 'begin' attribute after the element has started</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <svg> 6 <rect width="100" height="100" fill="blue"> 7 <animate id="anim" attributeName="x" values="100; 0" 8 begin="0s" dur="50ms" fill="freeze"/> 9 </rect> 10 </svg> 11 <script> 12 async_test(function(t) { 13 let anim = document.getElementById("anim"); 14 anim.endEventsReceived = 0; 15 anim.addEventListener('endEvent', t.step_func(function() { 16 anim.endEventsReceived++; 17 if (anim.endEventsReceived) 18 t.done(); 19 })); 20 onload = function() { 21 // Allow some time to pass before mutating 'begin'. This should ensure 22 // that the element has started. 23 requestAnimationFrame(function() { 24 anim.ownerSVGElement.setCurrentTime(0); 25 anim.setAttribute("begin", "50ms"); 26 }); 27 }; 28 }); 29 </script>