first-interval-in-the-past-contribute.html (1167B)
1 <!DOCTYPE html> 2 <title>Inserting animation elements that end before current presentation time</title> 3 <link rel="help" href="https://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-LC-Start"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/common/rendering-utils.js"></script> 7 <svg> 8 <rect width="100" height="100" fill="orange"> 9 <animate attributeName="fill" values="blue;red" dur="10ms" fill="freeze"/> 10 </rect> 11 </svg> 12 <script> 13 promise_test(t => { 14 const rect = document.querySelector('rect'); 15 const endWatcher = new Promise(resolve => { 16 document.querySelector('animate').onend = resolve; 17 }); 18 return endWatcher 19 .then(() => { 20 const oldAnimation = rect.firstElementChild; 21 const newAnimation = oldAnimation.cloneNode(false); 22 newAnimation.setAttribute('values', 'red;green'); 23 rect.replaceChild(newAnimation, oldAnimation); 24 return waitForAtLeastOneFrame(); 25 }) 26 .then(() => { 27 assert_equals(getComputedStyle(rect).fill, 'rgb(0, 128, 0)', 'new animation applies'); 28 }); 29 }); 30 </script>