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 validateFinishEvent(playerMiddle
, event
);
52 function onFinishBottom(event
) {
53 validateFinishEvent(playerBottom
, event
);
59 {left
: '10px', opacity
: '1', offset
: 0},
60 {left
: '100px', opacity
: '0', offset
: 1}
63 playerTop
= document
.getElementById('top').animate(keyframes
, 600);
64 playerTop
.name
= 'playerTop';
65 playerTop
.onfinish
= onFinishTop
;
67 playerMiddle
= document
.getElementById('middle').animate(keyframes
, 100);
68 playerMiddle
.name
= 'playerMiddle';
69 playerMiddle
.onfinish
= onFinishMiddle
;
71 playerBottom
= document
.getElementById('bottom').animate(keyframes
, 100);
72 playerBottom
.name
= 'playerBottom';
73 playerBottom
.onfinish
= onFinishBottom
;
75 if (window
.testRunner
) {
76 testRunner
.dumpAsText();
77 testRunner
.waitUntilDone();
81 window
.onload
= animate
;
86 <div class=
"anim" id=
"top"></div>
87 <div class=
"anim" id=
"middle"></div>
88 <div class=
"anim" id=
"bottom"></div>
89 <div id=
"results"></div>