6 <p>This test ensures that the focus ring is shown on the only anchor after tabbing out and inside the window.
</p>
7 <p><svg width=
"500" height=
"30"><a id=
"anchor" xlink:
href=
"javascript:log('anchor was clicked')"><text font-size=
"18px" y=
"20">Anchor
</text></a></svg></p>
13 var anchor
= document
.getElementById('anchor');
14 var input
= document
.getElementById('input');
15 window
.onfocus = function() {
16 log('window was focused');
18 window
.onblur = function() {
19 log('window was blurred');
21 anchor
.onfocus = function() {
22 log('anchor was focused');
24 anchor
.onblur = function() {
25 log('anchor was blurred');
27 input
.onfocus = function() {
28 log('input was focused');
30 input
.onblur = function() {
31 log('input was blurred');
33 window
.onload = function() {
34 if (window
.eventSender
) {
36 var anchorRect
= anchor
.getBoundingClientRect();
37 eventSender
.mouseMoveTo(anchorRect
.left
+ 2, anchorRect
.top
+ 2);
38 eventSender
.mouseDown();
39 eventSender
.mouseUp();
40 // Shift focus to input element.
41 eventSender
.keyDown('\t');
42 internals
.setFocused(false);
43 testRunner
.overridePreference('WebKitTabToLinksPreferenceKey', true);
44 // Set focus to the anchor.
45 internals
.setInitialFocus(false);
46 // Upon focus, the default focus ring should be displayed because the
47 // focus was triggered by the keyboard (tab).
48 internals
.setFocused(true);
52 function log(message
) {
53 var console
= document
.getElementById("console");
54 console
.textContent
+= message
+ '\n';