summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/editing/crashtests/inserthtml-after-temporarily-removing-document-element.html
blob: 7245fe3ddcc44d2c2a1485131ced5bde5cc927e5 (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
<!DOCTYPE html>
<html class="test-wait">
<head>
<meta charset="utf-8">
<title>Testcase for bug 716456 of Mozilla</title>
<script>
function boom() {
  const div = document.querySelector("div");
  div.contentEditable = "true";
  div.focus();

  const root = document.documentElement;
  document.removeChild(root);
  document.appendChild(root);

  setTimeout(() => {
    getSelection().collapse(div, 0);
    document.execCommand("inserthtml", false, "a");
    setTimeout(() => {
      document.documentElement.removeAttribute("class");
    }, 0);
  }, 0);
}
</script>
</head>
<body onload="boom();"><div></div></body>
</html>