OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 <style> | 5 <style> |
6 .spacer { | 6 .spacer { |
7 line-height: 100em; | 7 line-height: 100em; |
8 } | 8 } |
9 </style> | 9 </style> |
10 </head> | 10 </head> |
11 <body> | 11 <body> |
12 <p> | 12 <p> |
13 This test verifies that links to anchors without content work as exp
ected. | 13 This test verifies that links to anchors without content work as exp
ected. |
14 </p> | 14 </p> |
15 | 15 |
16 <span> | 16 <span> |
17 <a id="goto-1" href="#block1">Block 1</a><br> | 17 <a id="goto-1" href="#block1">Block 1</a><br> |
18 <a id="goto-2" href="#block2">Block 2</a><br> | 18 <a id="goto-2" href="#block2">Block 2</a><br> |
19 </span> | 19 </span> |
20 | 20 |
21 <a name="block1"></a><span class="h">Block 1</span><br> | 21 <a name="block1"></a><span class="h">Block 1</span><br> |
22 <span class="spacer"></span> | 22 <span class="spacer"></span> |
23 | 23 |
24 <a name="block2"></a><span class="h">Block 2</span><br> | 24 <a name="block2"></a><span class="h">Block 2</span><br> |
25 <span class="spacer"></span> | 25 <span class="spacer"></span> |
26 | 26 |
27 <script> | 27 <script> |
28 var scrollTopBeforeClick = document.body.scrollTop; | 28 var scrollTopBeforeClick = document.documentElement.scrollTop; |
29 document.getElementById('goto-1').click(); | 29 document.getElementById('goto-1').click(); |
30 if (document.body.scrollTop > scrollTopBeforeClick) | 30 if (document.documentElement.scrollTop > scrollTopBeforeClick) |
31 testPassed('Clicking link 1 scrolled to block 1.'); | 31 testPassed('Clicking link 1 scrolled to block 1.'); |
32 else | 32 else |
33 testFailed('Clicking link 1 didn\'t scroll as expected.'); | 33 testFailed('Clicking link 1 didn\'t scroll as expected.'); |
34 | 34 |
35 var scrollTopBeforeClick = document.body.scrollTop; | 35 var scrollTopBeforeClick = document.documentElement.scrollTop; |
36 document.getElementById('goto-2').click(); | 36 document.getElementById('goto-2').click(); |
37 if (document.body.scrollTop > scrollTopBeforeClick) | 37 if (document.documentElement.scrollTop > scrollTopBeforeClick) |
38 testPassed('Clicking link 2 scrolled to block 2.'); | 38 testPassed('Clicking link 2 scrolled to block 2.'); |
39 else | 39 else |
40 testFailed('Clicking link 2 didn\'t scroll as expected.'); | 40 testFailed('Clicking link 2 didn\'t scroll as expected.'); |
41 </script> | 41 </script> |
42 </body> | 42 </body> |
43 </html> | 43 </html> |
OLD | NEW |