getComputedStyle-animations-replaced-into-ib-split.html (1444B)
1 <!doctype html> 2 <title>getComputedStyle() returns the right style for animating nodes that have been just inserted into the document, and that have an ancestor whose layout tree was recreated (like an IB-split)</title> 3 <link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1585882"> 5 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 6 <link rel="author" title="Mozilla" href="https://mozilla.org"> 7 <script src=/resources/testharness.js></script> 8 <script src=/resources/testharnessreport.js></script> 9 <style> 10 @keyframes my-animation { 11 from { color: green; } 12 to { color: green; } 13 } 14 div { 15 color: red; 16 animation: my-animation 1s infinite linear paused; 17 } 18 </style> 19 <span> 20 <div></div> 21 </span> 22 <script> 23 test(() => { 24 let oldDiv = document.querySelector("div"); 25 window.unused = oldDiv.getBoundingClientRect(); // update layout 26 27 assert_equals(getComputedStyle(oldDiv).color, "rgb(0, 128, 0)", "Should take color from the animation"); 28 29 let newDiv = document.createElement("div"); 30 oldDiv.replaceWith(newDiv); 31 32 assert_equals(getComputedStyle(newDiv).color, "rgb(0, 128, 0)", "Should take color from the animation (just inserted into the document)"); 33 }, "getComputedStyle() should return animation styles for nodes just inserted into the document, even if they're in an IB-split"); 34 </script>