<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<style>
.spacer {
line-height: 100em;
}
</style>
</head>
<body>
<p>
This test verifies that links to anchors without content work as expected.
</p>
<span>
<a id="goto-1" href="#block1">Block 1</a><br>
<a id="goto-2" href="#block2">Block 2</a><br>
<a id="goto-3" href="#block3">Block 3</a><br>
</span>
<a name="block1"></a><span class="h">Block 1</span><br>
<span class="spacer"></span>
<a name="block2"></a><span class="h">Block 2</span><br>
<span class="spacer"></span>
<p>This block has whitespace inside and after the anchor element.</p>
<a name="block3"> </a> <span class="h">Block 3</span><br>
<span class="spacer"></span>
<script>
var scrollTopBeforeClick = document.scrollingElement.scrollTop;
document.getElementById('goto-1').click();
if (document.scrollingElement.scrollTop > scrollTopBeforeClick)
testPassed('Clicking link 1 scrolled to block 1.');
else
testFailed('Clicking link 1 didn\'t scroll as expected.');
scrollTopBeforeClick = document.scrollingElement.scrollTop;
document.getElementById('goto-2').click();
if (document.scrollingElement.scrollTop > scrollTopBeforeClick)
testPassed('Clicking link 2 scrolled to block 2.');
else
testFailed('Clicking link 2 didn\'t scroll as expected.');
scrollTopBeforeClick = document.scrollingElement.scrollTop;
document.getElementById('goto-3').click();
if (document.scrollingElement.scrollTop > scrollTopBeforeClick)
testPassed('Clicking link 3 scrolled to block 3.');
else
testFailed('Clicking link 3 didn\'t scroll as expected.');
</script>
</body>
</html>