2 <input type=
"search" id=
"target" placeholder=
"Placeholder text" onfocus=
"window.hasFocus=1">
3 <pre id=
"console"></pre>
7 function log(message
) {
8 document
.getElementById("console").appendChild(document
.createTextNode(message
+ "\n"));
12 if (!window
.eventSender
)
15 testRunner
.dumpAsText();
17 var target
= document
.getElementById("target");
18 var x
= target
.offsetParent
.offsetLeft
+ target
.offsetLeft
+ target
.offsetWidth
/ 2;
19 var y
= target
.offsetParent
.offsetTop
+ target
.offsetTop
+ target
.offsetHeight
/ 2;
21 eventSender
.mouseMoveTo(x
, y
);
22 eventSender
.mouseDown();
23 eventSender
.mouseUp();
25 log(hasFocus
? "PASS" : "FAIL");