When dragging a selection, clearing the selection in dragstart should not crash the...
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKit2Cocoa / dragstart-clear-selection.html
1 <meta name="viewport" content="width=device-width, initial-scale=1">
2 <code><p id="paragraph" style="font-size: 200px;">START DRAGGING</p></code>
3 <script>
4 function select(node) {
5     let range = document.createRange(node);
6     range.setStartBefore(node);
7     range.setEndAfter(node);
8     getSelection().removeAllRanges();
9     getSelection().addRange(range);
10 }
11
12 select(paragraph.childNodes[0]);
13 document.body.addEventListener("dragstart", () => {
14     getSelection().removeAllRanges();
15     paragraph.textContent = "PASS";
16     paragraph.style.color = "green";
17 });
18 </script>