2 <script src=
"../../resources/js-test.js"></script>
4 <div id=
"container" style=
"overflow: auto; width: 500px; height: 500px">
5 <div style=
"height: 5000px; width: 5000px;"></div>
8 description('Checks that the scroll event fires on elements asychronously and only once.');
13 function scrollHandler(event
)
16 if (eventCount
== 1) {
17 debug('Scroll event bubbles: ' + event
.bubbles
);
18 var container
= document
.getElementById('container');
19 var scrollX
= container
.scrollLeft
;
20 var scrollY
= container
.scrollTop
;
21 testPassed('Scroll position: (' + scrollX
+ ', ' + scrollY
+ ')');
22 // Don't call notifyDone straight away, in case there's another scroll event coming.
23 doneTimeout
= setTimeout(finishJSTest
, 100);
25 clearTimeout(doneTimeout
);
26 testFailed('Scroll handler was invoked ' + eventCount
+ ' times');
33 var container
= document
.getElementById('container');
34 container
.addEventListener('scroll', scrollHandler
, false);
35 container
.scrollTop
= 100;
37 testFailed('Scroll event fired synchronously');
40 container
.scrollTop
= 200;
42 var jsTestIsAsync
= true;