| <script src="../resources/js-test-pre.js"></script> |
| description("This test checks that registering an event listener on an animation whose JS wrapper would otherwise be garbage-collected still fires registered event listeners."); |
| // A longer animation that could not be garbage-collected under any circumstance allows us to finish the test |
| // with a reasonable delay without hard-coding a timeout. |
| const timeoutAnimation = document.getElementById("target").animate({ marginRight: ["0px", "100px"] }, 1000); |
| timeoutAnimation.addEventListener("finish", finishJSTest); |
| const animation = document.getElementById("target").animate({ marginLeft: ["0px", "100px"] }, 100); |
| animation._isMyAnimation = true; |
| animation.addEventListener("finish", event => { |
| shouldBeTrue("event.target._isMyAnimation"); |
| <script src="../resources/js-test-post.js"></script> |