blob: 7d5ef8867b852b953c79a5c73c34a4d4757e0ebb [file] [log] [blame]
<html>
<script src="../../resources/js-test-pre.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>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>