6 <p>This test ensures that the focus ring is shown on the only anchor after tabbing out and inside the window.
</p>
7 <a id=
"anchor" href=
"javascript:log('anchor was clicked')">Anchor
</a>
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 eventSender
.mouseMoveTo(anchor
.offsetLeft
+ 2, anchor
.offsetTop
+ 2);
37 eventSender
.mouseDown();
38 eventSender
.mouseUp();
39 // Shift focus to input element.
40 eventSender
.keyDown('\t');
41 internals
.setFocused(false);
42 testRunner
.overridePreference('WebKitTabToLinksPreferenceKey', true);
43 // Set focus to the anchor.
44 internals
.setInitialFocus(false);
45 // Upon focus, the default focus ring should be displayed because the
46 // focus was triggered by the keyboard (tab).
47 internals
.setFocused(true);
51 function log(message
) {
52 var console
= document
.getElementById("console");
53 console
.textContent
+= message
+ '\n';