6 <p>This test ensures that the focus ring is not shown on the anchor after blurring and focusing 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>
12 // This test differs from click-anchor-refocus-window.html in two ways:
13 // 1. getBoundingClientRect().top/left is used instead of .offsetLeft/Top,
14 // because offsetLeft is relative to the <svg> element.
15 // 2. document.activeElement is checked instead of using anchor.onfocus/onblur,
16 // because the presence of focus events causes a focus ring to be shown on
17 // the SVG anchor (https://crbug.com/445798).
18 var anchor
= document
.getElementById('anchor');
19 window
.onfocus = function() {
20 log('window was focused');
22 window
.onblur = function() {
23 log('window was blurred');
25 window
.onload = function() {
26 if (window
.eventSender
) {
28 var anchorRect
= anchor
.getBoundingClientRect();
29 eventSender
.mouseMoveTo(anchorRect
.left
+ 2, anchorRect
.top
+ 2);
30 eventSender
.mouseDown();
31 eventSender
.mouseUp();
32 log('activeElement is ' + (document
.activeElement
== anchor
? 'anchor' : document
.activeElement
));
33 internals
.setFocused(false);
34 internals
.setFocused(true);
35 log('activeElement is ' + (document
.activeElement
== anchor
? 'anchor' : document
.activeElement
));
39 function log(message
) {
40 var console
= document
.getElementById("console");
41 console
.textContent
+= message
+ '\n';