blob: c4b7c0370d68949e117e918665169b24d94d71f8 [file] [log] [blame]
<html>
<script src="../../resources/js-test.js"></script>
<body style="min-width: 5000px; min-height: 5000px">
<script>
description('Checks that the scroll event fires on the document asychronously and only once.');
var eventCount = 0;
var doneTimeout;
onscroll = function(event)
{
eventCount++;
if (eventCount == 1) {
debug('Scroll event bubbles: ' + event.bubbles);
var scrollX = document.scrollingElement.scrollLeft;
var scrollY = document.scrollingElement.scrollTop;
testPassed('Scroll position: (' + scrollX + ', ' + scrollY + ')');
// Don't call notifyDone straight away, in case there's another scroll event coming.
doneTimeout = setTimeout(finishJSTest, 100);
} else {
clearTimeout(doneTimeout);
testFailed('Scroll handler was invoked ' + eventCount + ' times');
finishJSTest();
}
}
onload = function()
{
window.scrollTo(100, 100);
if (eventCount > 0) {
testFailed('Scroll event fired synchronously');
finishJSTest();
}
window.scrollTo(200, 200);
}
var jsTestIsAsync = true;
</script>
</body>
</html>