summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/editing/crashtests/delete-and-justifycenter-recursively-with-mutation-event-listeners.html
blob: ce0c7e886f7c2755b96f21b4b431560e35a132e3 (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
<!doctype html>
<html class="test-wait">
<head>
<meta charset="utf-8">
<script>
try {
  function onDOMNodeInsertedOfContentEditable() {
    getSelection().collapse(document.querySelector("input"));
    document.execCommand("justifyCenter");
    document.querySelector("dl").addEventListener("DOMSubtreeModified", onDOMSubtreeModifiedOfDLElement);
    document.querySelector("dl").appendChild(document.querySelector("style"));
  }
  function onDOMSubtreeModifiedOfDLElement() {
    document.execCommand("delete");
    document.querySelector("label").appendChild(document.querySelector("input"));
    document.querySelector("dd[contenteditable]").addEventListener("DOMNodeInserted", onDOMNodeInsertedOfContentEditable);
  }
  addEventListener("load", () => {
    onDOMNodeInsertedOfContentEditable();
    document.documentElement.removeAttribute("class");
  });
} catch (ex) {
  // maybe too many recursive exception would be thrown.
  document.documentElement.removeAttribute("class");
}
</script>
</head>
<body><label></label>
<dl>
<dd contenteditable>
<style>@</style>
<input>
</body>
</html>