summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/editing/crashtests/designMode-caret-change.html
blob: be80afd4ab8a474572d1732baecdcb1f052c57fb (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
<!doctype html>
<html class="test-wait reftest-wait">
<style>
button {
  background-repeat: no-repeat;
}
*:last-child {
  opacity: 0;
  animation: kf ease-in, steps(65, start) 0.92 paused;
  border-radius: inherit
}
@keyframes kf {}
</style>
<script>
let animationEnded = false;
let selectionChanged = false;
function maybeFinishTest() {
  if (animationEnded && selectionChanged) {
    requestAnimationFrame(() => requestAnimationFrame(() => {
      document.documentElement.className = "";
    }));
  }
}
document.addEventListener("DOMContentLoaded", () => {
  document.designMode = "on"
  window.onanimationend = () => {
    document.execCommand("insertHTML", false, "A")
    animationEnded = true;
    maybeFinishTest();
  }
  document.onselectionchange = () => {
    document.execCommand("selectAll", false)
    selectionChanged = true;
    maybeFinishTest();
  }
})
</script>