animation-pseudo-dynamic-001.html (1141B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Animation of pseudo-element is stopped properly in presence of dynamic DOM change that reconstructs the layout tree</title> 4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-animations/"> 7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1564366"> 8 <link rel="match" href="animation-pseudo-dynamic-001-ref.html"> 9 <style> 10 @keyframes anim { 11 from { background-color: red } 12 to { background-color: red } 13 } 14 .test { 15 display: flex; 16 } 17 .test::before { 18 content: ""; 19 display: block; 20 width: 100px; 21 height: 100px; 22 background-color: green; 23 } 24 .tweak::before { 25 animation: anim 2s linear infinite; 26 } 27 </style> 28 <div class="test tweak">foo</div> 29 <script> 30 onload = function() { 31 const div = document.querySelector(".test"); 32 const pseudoStyle = getComputedStyle(div, "::before"); 33 div.getBoundingClientRect(); // update layout 34 div.classList.remove("tweak"); 35 div.innerHTML = ""; // This is necessary to trigger the bug. 36 } 37 </script>