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