640b5212cba38c823ec7d2ec564df480b407357c
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKitCocoa / dragstart-change-selection-offscreen.html
1 <!DOCTYPE html>
2 <html>
3 <style>
4 body {
5     font-size: 200px;
6 }
7
8 #offscreen {
9     position: absolute;
10     top: -500vh;
11     left: -500vw;
12 }
13 </style>
14 <div id="onscreen">DRAG ME</div>
15 <div id="offscreen">FAR OFFSCREEN</div>
16 <script>
17 function selectChildNodesOfElement(element)
18 {
19     let range = document.createRange();
20     range.setStartBefore(element.childNodes[0])
21     range.setEndAfter(element.childNodes[element.childNodes.length - 1]);
22     getSelection().removeAllRanges();
23     getSelection().addRange(range);
24 }
25 selectChildNodesOfElement(onscreen);
26 document.body.addEventListener("dragstart", () => selectChildNodesOfElement(offscreen));
27 </script>
28 </html>