1 <p>This tests to see that a selection inside an input field is removed when clicking (and focusing) a button in the same frame.
</p>
2 <input id=
"input" type=
"text" value=
"After you click the button below, this content should not be selected." size=
"60"><br>
3 <input id=
"button" type=
"button" value=
"Click Me"><br>
8 console
= document
.getElementById("console");
9 li
= document
.createElement("li");
10 text
= document
.createTextNode(msg
);
11 console
.appendChild(li
);
15 if (window
.testRunner
)
16 testRunner
.dumpAsText();
17 var input
= document
.getElementById("input");
19 input
.setSelectionRange(0, input
.value
.length
);
20 if (!input
.selectionEnd
)
21 log("Failure: There was no selection inside the input field when the test began.");
22 if (!window
.eventSender
)
23 log("Test not run because there is no event sender.");
25 var button
= document
.getElementById("button");
26 var x
= button
.offsetParent
.offsetLeft
+ button
.offsetLeft
+ button
.offsetWidth
/ 2;
27 var y
= button
.offsetParent
.offsetTop
+ button
.offsetTop
+ button
.offsetHeight
/ 2;
28 eventSender
.mouseMoveTo(x
, y
);
29 eventSender
.mouseDown();
30 eventSender
.mouseUp();
31 if (!input
.selectionEnd
)
32 log("Failure: There was still a selection after clicking a button.");