3 <script src=
"../resources/js-test.js"></script>
13 animation: fade
1s infinite;
26 description("Animations should be canceled when an element is removed from the document.");
28 if (!window
.testRunner
)
29 debug("FAIL: This test requires testRunner.");
31 const expectedValues
= [
32 // [time, element-id, property, expected-value, tolerance]
33 [0.5, "target2", "opacity", 1, 0],
36 // Timeout so you can see it really animating at the start.
37 var input
= document
.getElementById("target1");
38 requestAnimationFrame(function() {
39 requestAnimationFrame(function() {
40 input
.type
= "button";
42 // Remove the element, but there's no detach() since it's already detach'ed().
44 // Change the id which should mean no more animations.
46 // Insert the element again.
47 document
.body
.appendChild(input
);
48 shouldBe("document.timeline.getAnimations().length", "0");