4 <script src=
"../../resources/js-test.js"></script>
13 This test verifies that links to anchors without content work as expected.
17 <a id=
"goto-1" href=
"#block1">Block
1</a><br>
18 <a id=
"goto-2" href=
"#block2">Block
2</a><br>
21 <a name=
"block1"></a><span class=
"h">Block
1</span><br>
22 <span class=
"spacer"></span>
24 <a name=
"block2"></a><span class=
"h">Block
2</span><br>
25 <span class=
"spacer"></span>
28 var scrollTopBeforeClick
= document
.scrollingElement
.scrollTop
;
29 document
.getElementById('goto-1').click();
30 if (document
.scrollingElement
.scrollTop
> scrollTopBeforeClick
)
31 testPassed('Clicking link 1 scrolled to block 1.');
33 testFailed('Clicking link 1 didn\'t scroll as expected.');
35 var scrollTopBeforeClick
= document
.scrollingElement
.scrollTop
;
36 document
.getElementById('goto-2').click();
37 if (document
.scrollingElement
.scrollTop
> scrollTopBeforeClick
)
38 testPassed('Clicking link 2 scrolled to block 2.');
40 testFailed('Clicking link 2 didn\'t scroll as expected.');