4 <title>Tests that unprefixed animation events are correctly fired when listeners are on both versions.
</title>
12 background-color: #
999;
16 animation-duration:
0.3s;
26 if (window
.testRunner
) {
27 testRunner
.dumpAsText();
28 testRunner
.waitUntilDone();
32 document
.getElementById('result').innerHTML
= 'FAIL: Got ' + iterationEventReceived
+ ' animationCount events and '
33 + prefixedEventReceived
+ ' prefixed events.';
36 var startEventReceived
= false;
37 var endEventReceived
= false;
38 var prefixedEventReceived
= 0;
40 document
.addEventListener('webkitAnimationStart', function() {
41 prefixedEventReceived
++;
44 document
.addEventListener('animationstart', function() {
45 startEventReceived
= true;
48 document
.addEventListener('animationiteration', function() {
49 if (startEventReceived
&& endEventReceived
&& prefixedEventReceived
== 0) {
50 document
.getElementById('result').innerHTML
= 'PASS: All events have been received as expected.';
53 if (window
.testRunner
)
54 testRunner
.notifyDone();
57 document
.addEventListener('webkitAnimationIteration', function() {
58 prefixedEventReceived
++;
61 document
.addEventListener('webkitAnimationEnd', function() {
62 prefixedEventReceived
++;
65 document
.addEventListener('animationend', function() {
66 endEventReceived
= true;
67 document
.getElementById('box').className
= '';
68 // Launch again the animation to catch the animation iteration events this time.
69 setTimeout(function () {
70 document
.getElementById('box').style
.animationIterationCount
= "infinite";
71 document
.getElementById('box').className
= 'animate';
77 // Animation begins once we append the DOM node to the document.
78 var boxNode
= document
.createElement('div');
80 boxNode
.className
= 'animate';
81 document
.body
.appendChild(boxNode
);
86 Tests that unprefixed animation events are correctly fired when listeners are on both versions.
87 <pre id=
"result">FAIL: No animation events received
</pre>