eventbase-after-removal.html (924B)
1 <!DOCTYPE html> 2 <title>Event base 'begin' after removal from the document</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <svg> 6 <rect height="100" width="100"> 7 <animate begin="click" dur="1s" attributeName="width" from="50" to="100"/> 8 </rect> 9 </svg> 10 <script> 11 async_test(t => { 12 const svg = document.querySelector('svg'); 13 document.body.removeChild(svg); 14 document.body.appendChild(svg); 15 16 document.querySelector('animate').onbegin = t.step_func_done(); 17 18 // Defensively, wait for 'load' and a paint before attempting to trigger a 19 // 'click'. 20 window.onload = t.step_func(() => { 21 requestAnimationFrame(t.step_func(() => { 22 requestAnimationFrame(t.step_func(() => { 23 const rect = svg.firstElementChild; 24 rect.dispatchEvent(new MouseEvent('click')); 25 })); 26 })); 27 }); 28 }); 29 </script>