OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <style> |
| 4 #content { |
| 5 width: 7500px; |
| 6 height: 7500px; |
| 7 background-color: blue; |
| 8 } |
| 9 </style> |
| 10 <script src="../../resources/js-test.js"></script> |
| 11 <script> |
| 12 onload = function() { |
| 13 description('Test that calling scroll methods on the body element scrolls
the viewport in quirks mode'); |
| 14 |
| 15 debug('Test that "scroll" on the document element does not scroll'); |
| 16 document.documentElement.scroll(100, 100); |
| 17 shouldBe("document.documentElement.scrollTop", "0"); |
| 18 shouldBe("document.documentElement.scrollLeft", "0"); |
| 19 shouldBe("document.body.scrollTop", "0"); |
| 20 shouldBe("document.body.scrollLeft", "0"); |
| 21 |
| 22 debug(''); |
| 23 debug('Test that "scrollTo" on the document element does not scroll'); |
| 24 document.documentElement.scrollTo(100, 100); |
| 25 shouldBe("document.documentElement.scrollTop", "0"); |
| 26 shouldBe("document.documentElement.scrollLeft", "0"); |
| 27 shouldBe("document.body.scrollTop", "0"); |
| 28 shouldBe("document.body.scrollLeft", "0"); |
| 29 |
| 30 debug(''); |
| 31 debug('Test that "scrollBy" on the document element does not scroll'); |
| 32 document.documentElement.scrollBy(100, 100); |
| 33 shouldBe("document.documentElement.scrollTop", "0"); |
| 34 shouldBe("document.documentElement.scrollLeft", "0"); |
| 35 shouldBe("document.body.scrollTop", "0"); |
| 36 shouldBe("document.body.scrollLeft", "0"); |
| 37 |
| 38 debug(''); |
| 39 debug('Test that "scroll" on the body element scrolls'); |
| 40 document.body.scroll(50, 100); |
| 41 shouldBe("document.documentElement.scrollTop", "0"); |
| 42 shouldBe("document.documentElement.scrollLeft", "0"); |
| 43 shouldBe("document.body.scrollTop", "100"); |
| 44 shouldBe("document.body.scrollLeft", "50"); |
| 45 |
| 46 debug(''); |
| 47 debug('Test that "scrollTo" on the body element scrolls'); |
| 48 document.body.scrollTo(450, 200); |
| 49 shouldBe("document.documentElement.scrollTop", "0"); |
| 50 shouldBe("document.documentElement.scrollLeft", "0"); |
| 51 shouldBe("document.body.scrollTop", "200"); |
| 52 shouldBe("document.body.scrollLeft", "450"); |
| 53 |
| 54 debug(''); |
| 55 debug('Test that "scrollBy" on the body element scrolls'); |
| 56 document.body.scrollBy(300, 100); |
| 57 shouldBe("document.documentElement.scrollTop", "0"); |
| 58 shouldBe("document.documentElement.scrollLeft", "0"); |
| 59 shouldBe("document.body.scrollTop", "300"); |
| 60 shouldBe("document.body.scrollLeft", "750"); |
| 61 } |
| 62 </script> |
| 63 </head> |
| 64 |
| 65 <body> |
| 66 <div id="content"></div> |
| 67 </body> |
| 68 </html> |
OLD | NEW |