4 <style type=
"text/css">
10 background-color: black
;
13 <script type=
"text/javascript">
15 function log(message
) {
16 var results
= document
.getElementById('results');
17 results
.innerHTML
+= message
+ '<br>';
20 function validateFinishEvent(player
, event
) {
21 if (event
.target
=== player
) {
22 log('PASS: ' + player
.name
+ ' is target');
24 log('FAIL: expected target named ' + player
.name
+ ', actual target is ' + event
.target
);
26 if (event
.currentTime
=== player
.currentTime
) {
27 log('PASS: event currentTime equals player currentTime');
29 log('FAIL: event currentTime ' + event
.currentTime
+ ' does not equal player currentTime ' + player
.currentTime
);
31 if (event
.timelineTime
=== document
.timeline
.currentTime
) {
32 log('PASS: event timelineTime equals timeline currentTime');
34 log('FAIL: event timelineTime ' + event
.timelineTime
+
35 ' does not equal timeline currentTime ' + document
.timeline
.currentTime
);
39 var playerTop
, playerMiddle
, playerBottom
;
41 function onFinishTop(event
) {
42 validateFinishEvent(playerTop
, event
);
43 if (window
.testRunner
) {
44 testRunner
.notifyDone();
48 function onFinishMiddle(event
) {
49 log('FAIL: seeking to finish should not queue event');
52 function onFinishBottom(event
) {
53 log('FAIL: seeking past finish should not queue event');
59 {left
: '10px', opacity
: '1', offset
: 0},
60 {left
: '100px', opacity
: '0', offset
: 1}
63 playerMiddle
= document
.getElementById('middle').animate(keyframes
, 70.0);
64 playerMiddle
.name
= 'playerMiddle';
65 playerMiddle
.onfinish
= onFinishMiddle
;
66 playerMiddle
.finish();
67 playerMiddle
.currentTime
= 0;
69 playerBottom
= document
.getElementById('bottom').animate(keyframes
, 70.0);
70 playerBottom
.name
= 'playerBottom';
71 playerBottom
.onfinish
= onFinishBottom
;
72 playerBottom
.currentTime
= 80.0;
73 playerBottom
.currentTime
= 0;
75 playerTop
= document
.getElementById('top').animate(keyframes
, 90.0);
76 playerTop
.name
= 'playerTop';
77 playerTop
.onfinish
= onFinishTop
;
80 if (window
.testRunner
) {
81 testRunner
.dumpAsText();
82 testRunner
.waitUntilDone();
86 window
.onload
= animate
;
91 <div class=
"anim" id=
"top"></div>
92 <div class=
"anim" id=
"middle"></div>
93 <div class=
"anim" id=
"bottom"></div>
94 <div id=
"results"></div>