41 lines
1.2 KiB
HTML
41 lines
1.2 KiB
HTML
<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>
|