2 To test this manually, press mouse button below the '!' and drag the mouse to the comma between
"Hello" and
"world!". It's OK if
"world!" is selected.
5 <div id=
"result" style=
"width: 200px;">
6 <span>Hello,
</span><span id=
"world">world!
</span><br><span style=
"padding-left: 200px; padding-bottom: 200px; background-color: blue; height: 200px;"></span>
10 if (window
.testRunner
) {
11 testRunner
.dumpAsText();
13 var world
= document
.getElementById("world");
14 var endX
= world
.offsetLeft
;
15 var startX
= endX
+ world
.offsetWidth
;
16 var endY
= world
.offsetTop
;
17 var startY
= endY
+ 50;
19 eventSender
.mouseMoveTo(startX
, startY
);
20 eventSender
.mouseDown();
21 eventSender
.mouseMoveTo(startX
, startY
);
22 eventSender
.mouseMoveTo(endX
, endY
);
23 eventSender
.mouseUp();
25 var result
= document
.getElementById("result");
26 if (window
.getSelection() == "world!") {
27 result
.style
.backgroundColor
= "green";
28 result
.innerHTML
= "PASS";
30 result
.innerHTML
= "FAILED: the selection was " + window
.getSelection();