summaryrefslogtreecommitdiffstats
path: root/image/test/reftest/gif/test_bug641198.html
blob: 46bdb0d47c1a2ec2cd853c7fc48a56c078a45b89 (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
45
46
47
48
49
50
51
52
53
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
<title>Test for bug 641198</title>
<link rel="stylesheet" href="ImageDocument.css">
<style type="text/css" media=screen>
   a.animated1 {
      display: block;
      width: 40px;
      height: 40px;
      background: url("animation1a.gif") no-repeat 0 0;
   }

   a.animated1 span {
      position: absolute;
      top: -999em;
   }

   a.animated2 {
      display: block;
      width: 40px;
      height: 40px;
      background: url("animation2a.gif") no-repeat 0 0;
   }

   a.animated2 span {
      position: absolute;
      top: -999em;
   }
</style>
</head>
<body onload="doTimeout()">

<a id="animated" href="#" title="Animated"><span>Animated</span></a>

<script>
// We check whether changing the class will lead to the animation being
// run from the beginning, even if the animation was already shown
// before.
var counter = 0;
function doTimeout() {
  if (counter == 4) {
    document.documentElement.className = '';
  } else {
    document.getElementById("animated").setAttribute("class", "animated" + ((counter % 2)+1));
    setTimeout(doTimeout, counter == 3 ? 500 : 250); // Wait a bit more for the last one, to prevent oranges
  }
  counter++;
}
</script>
</body>
</html>