summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-animations/crashtests/reparent-animating-element-002.html
blob: 0d3549fc33dae6c4a351f00790e63262b7258ff1 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html class="test-wait">
<title>CSS Test (Animations): Reparenting an element with a web animation on the compositor</title>
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="author" title="Google" href="http://www.google.com/">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1305487">
<meta name="assert" content="This should not crash.">
<!--

The Chromium implementation of <marquee> essentially uses web animations
underneath.  However, I was unable to make a testcase for this crash
that uses web animations directly.  Despite that, it still seems worth
adding this testcase here in WPT.

-->

<style>
#animate {
  width: 100px;
  height: 100px;
}
#newparent {
  display: none;
}
</style>
<marquee id="animate">X</marquee>
<div id="newparent"></div>
<script>

let a = document.getElementById("animate");

requestAnimationFrame(function() {
  // use setTimeout because the crash doesn't happen if we do this inside
  // a requestAnimationFrame callback
  setTimeout(function() {
    a.remove();
    document.getElementById("newparent").appendChild(a);
    requestAnimationFrame(function() {
      document.documentElement.classList.remove("test-wait");
    });
  }, 0);
});

</script>