summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-color/animation/opacity-animation-ending-correctly-001.html
blob: 1fb36cd366ff260f073c7de6d8062d9fceff5340 (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
<!DOCTYPE HTML>
<html class="reftest-wait">
<title>CSS Test (Color): ending of opacity animation</title>
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="author" title="Google" href="https://www.google.com/">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1330438">
<link rel="help" href="https://www.w3.org/TR/css-color-3/#transparency">
<link rel="match" href="opacity-animation-ending-correctly-001-ref.html">

<style>
#test {
  position: sticky;
  top: 0;
  height: 50px;
  background: blue;
  transition: opacity 50ms step-start;
}

#test.fade {
  opacity: 0.2;
}

.tall {
  height: 5000px;
}
</style>

<div id="test">
</div>
<div class="tall">
</div>

<script>
function flushStyleLayoutAndPrePaint() {
  document.elementFromPoint(10, 10);
}

document.getElementById("test").addEventListener("transitionend", function(e) {
  document.documentElement.classList.remove("reftest-wait");
});
requestAnimationFrame(function() {
  flushStyleLayoutAndPrePaint();
  requestAnimationFrame(function() {
    document.getElementById("test").classList.add("fade");
    flushStyleLayoutAndPrePaint();
  });
});
</script>