summaryrefslogtreecommitdiffstats
path: root/layout/reftests/web-animations/cancel-animation-with-selector-matching.html
blob: 7c78bc414e23c3843c4c897f9f32309bb93c001f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html class="reftest-wait">
<title>Discard cancelled animation styles</title>
<style>
#test {
  width: 100px; height: 100px;
  background-color: white;
}
.changed {
  color: red;
}

</style>
<div id="test"></div>
<script>
  var target = document.getElementById("test");
  var anim = target.animate({ backgroundColor: [ "red", "red" ] }, 100000);

  anim.ready.then(() => {
    anim.cancel();
    // Add a class name to cause selector matching in a subsequent restyle.
    target.classList.add("changed");

    document.documentElement.classList.remove("reftest-wait");
  });
</script>