blob: cb52a13f8de9d9cb98040d179d7df1e9ea70f0ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<html>
<script src="../js/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.body.scrollLeft;
var scrollY = document.body.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>
|