forked from burg/timelapse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll-event-phase.html
40 lines (34 loc) · 938 Bytes
/
scroll-event-phase.html
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
40
<html>
<script src="../../resources/js-test-pre.js"></script>
<body style="min-height: 2000px">
<script type="text/javascript">
description('Tests that we can listen for scroll events on the document in both the capture and bubble phases.');
var triggeredCaptureListener = false;
var triggeredBubbleListener = false;
window.addEventListener(
'scroll',
function() {
triggeredCaptureListener = true;
checkComplete();
},
true);
window.addEventListener(
'scroll',
function(event) {
triggeredBubbleListener = true;
checkComplete();
},
false);
function checkComplete()
{
if (triggeredCaptureListener && triggeredBubbleListener) {
debug('Both capture and bubble phase listeners were invoked.');
finishJSTest();
}
}
window.scrollTo(200, 200);
var jsTestIsAsync = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>