| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
| 3 <body style="min-width: 5000px; min-height: 5000px"> | 3 <body style="min-width: 5000px; min-height: 5000px"> |
| 4 <script> | 4 <script> |
| 5 description('Checks that the scroll event fires on the document asychronously an
d only once.'); | 5 description('Checks that the scroll event fires on the document asychronously an
d only once.'); |
| 6 | 6 |
| 7 var eventCount = 0; | 7 var eventCount = 0; |
| 8 var doneTimeout; | 8 var doneTimeout; |
| 9 | 9 |
| 10 onscroll = function(event) | 10 onscroll = function(event) |
| 11 { | 11 { |
| 12 eventCount++; | 12 eventCount++; |
| 13 if (eventCount == 1) { | 13 if (eventCount == 1) { |
| 14 debug('Scroll event bubbles: ' + event.bubbles); | 14 debug('Scroll event bubbles: ' + event.bubbles); |
| 15 var scrollX = document.body.scrollLeft; | 15 var scrollX = document.scrollingElement.scrollLeft; |
| 16 var scrollY = document.body.scrollTop; | 16 var scrollY = document.scrollingElement.scrollTop; |
| 17 testPassed('Scroll position: (' + scrollX + ', ' + scrollY + ')'); | 17 testPassed('Scroll position: (' + scrollX + ', ' + scrollY + ')'); |
| 18 // Don't call notifyDone straight away, in case there's another scroll e
vent coming. | 18 // Don't call notifyDone straight away, in case there's another scroll e
vent coming. |
| 19 doneTimeout = setTimeout(finishJSTest, 100); | 19 doneTimeout = setTimeout(finishJSTest, 100); |
| 20 } else { | 20 } else { |
| 21 clearTimeout(doneTimeout); | 21 clearTimeout(doneTimeout); |
| 22 testFailed('Scroll handler was invoked ' + eventCount + ' times'); | 22 testFailed('Scroll handler was invoked ' + eventCount + ' times'); |
| 23 finishJSTest(); | 23 finishJSTest(); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 onload = function() | 27 onload = function() |
| 28 { | 28 { |
| 29 window.scrollTo(100, 100); | 29 window.scrollTo(100, 100); |
| 30 if (eventCount > 0) { | 30 if (eventCount > 0) { |
| 31 testFailed('Scroll event fired synchronously'); | 31 testFailed('Scroll event fired synchronously'); |
| 32 finishJSTest(); | 32 finishJSTest(); |
| 33 } | 33 } |
| 34 window.scrollTo(200, 200); | 34 window.scrollTo(200, 200); |
| 35 } | 35 } |
| 36 var jsTestIsAsync = true; | 36 var jsTestIsAsync = true; |
| 37 </script> | 37 </script> |
| 38 </body> | 38 </body> |
| 39 </html> | 39 </html> |
| OLD | NEW |