<!DOCTYPE html>
<body>
<a href="#foo" onclick="return false;">link</a>
<input>
<script src="../../resources/js-test.js"></script>
<script>
description('Click on a focused anchor element should not change focus, and click on a non-focused anchor element should remove focus of another element.');
jsTestIsAsync = true;
var a = document.querySelector('a');
var input = document.querySelector('input');
window.onload = function() {
a.focus();
shouldBe('document.activeElement', 'a', true);
eventSender.mouseMoveTo(a.offsetLeft + a.offsetWidth / 2, a.offsetTop + a.offsetHeight / 2);
eventSender.mouseDown();
eventSender.mouseUp();
shouldBe('document.activeElement', 'a');
input.focus();
eventSender.mouseDown();
eventSender.mouseUp();
shouldBe('document.activeElement', 'document.body');
finishJSTest();
};
</script>
</body>