summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/selection/crashtests/selection-modify-line-boundary-around-shadow.html
blob: bfca0402a7096a61b17d8dfa68f736f76fd3dcfa (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
<!doctype html>
<html class="reftest-wait">
<head>
<meta charset="utf-8">
<script>
document.addEventListener("DOMContentLoaded", () => {
  const shadowRoot = b.attachShadow({mode: "closed"});
  shadowRoot.textContent = "A";
  getSelection().collapse(shadowRoot.firstChild, 1);

  function moveCaretAndReplaceBodyWithAddress() {
    getSelection().modify("move", "forward", "lineboundary");
    document.documentElement.replaceChild(a, document.body);
  }

  requestAnimationFrame(() => {
    requestAnimationFrame(moveCaretAndReplaceBodyWithAddress);
    requestAnimationFrame(moveCaretAndReplaceBodyWithAddress);
    requestAnimationFrame(
      () => document.documentElement.removeAttribute("class")
    );
  });
}, {once: true});
</script>
</head>
<body>
<address id="a"></address>
<div id="b"></div>
</body>
</html>