Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / anchor-without-content.html
blob9dcc673085e65cec321ce9ee57f0bfcfbdc47fac
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style>
6 .spacer {
7 line-height: 100em;
9 </style>
10 </head>
11 <body>
12 <p>
13 This test verifies that links to anchors without content work as expected.
14 </p>
16 <span>
17 <a id="goto-1" href="#block1">Block 1</a><br>
18 <a id="goto-2" href="#block2">Block 2</a><br>
19 </span>
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>
27 <script>
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.');
32 else
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.');
39 else
40 testFailed('Clicking link 2 didn\'t scroll as expected.');
41 </script>
42 </body>
43 </html>