| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Tests that unprefixed animation events are correctly fired when listene
rs are on both versions.</title> | 4 <title>Tests that unprefixed animation events are correctly fired when using h
tml event listeners (only unprefixed should be fired).</title> |
| 5 <style> | 5 <style> |
| 6 #box { | 6 #box { |
| 7 position: relative; | 7 position: relative; |
| 8 left: 100px; | 8 left: 100px; |
| 9 top: 10px; | 9 top: 10px; |
| 10 height: 100px; | 10 height: 100px; |
| 11 width: 100px; | 11 width: 100px; |
| 12 animation-duration: 0.3s; | 12 animation-duration: 0.3s; |
| 13 animation-name: anim; | 13 animation-name: anim; |
| 14 background-color: #999; | 14 background-color: #999; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 function fail() { | 28 function fail() { |
| 29 document.getElementById('result').innerHTML = 'FAIL: Got ' + iterationEven
tReceived + ' animationCount events and ' | 29 document.getElementById('result').innerHTML = 'FAIL: Got ' + iterationEven
tReceived + ' animationCount events and ' |
| 30 + prefixedEventReceived + ' prefixed events.'; | 30 + prefixedEventReceived + ' prefixed events.'; |
| 31 } | 31 } |
| 32 | 32 |
| 33 var iterationEventReceived = 0; | 33 var iterationEventReceived = 0; |
| 34 var startEventReceived = false; | 34 var startEventReceived = false; |
| 35 var prefixedEventReceived = 0; | 35 var prefixedEventReceived = 0; |
| 36 document.addEventListener('webkitAnimationStart', function() { | 36 |
| 37 function recordPrefixedEvent() { |
| 37 prefixedEventReceived++; | 38 prefixedEventReceived++; |
| 38 }, false); | 39 } |
| 39 document.addEventListener('animationstart', function() { | 40 |
| 41 function recordAnimationStart() { |
| 40 startEventReceived = true; | 42 startEventReceived = true; |
| 41 }, false); | 43 } |
| 42 | 44 |
| 43 document.addEventListener('animationiteration', function() { | 45 function recordAnimationIteration() { |
| 44 ++iterationEventReceived; | 46 ++iterationEventReceived; |
| 45 }, false); | 47 } |
| 46 document.addEventListener('webkitAnimationIteration', function() { | |
| 47 prefixedEventReceived++; | |
| 48 }, false); | |
| 49 | 48 |
| 50 document.addEventListener('webkitAnimationEnd', function() { | 49 function recordAnimationEnd() { |
| 51 prefixedEventReceived++; | 50 if (iterationEventReceived > 0 && iterationEventReceived <= 2 && startEv
entReceived && prefixedEventReceived == 0) |
| 52 }, false); | |
| 53 document.addEventListener('animationend', function() { | |
| 54 if (iterationEventReceived <= 2 && startEventReceived && prefixedEventRe
ceived == 0) | |
| 55 document.getElementById('result').innerHTML = 'PASS: All events have
been received as expected.'; | 51 document.getElementById('result').innerHTML = 'PASS: All events have
been received as expected.'; |
| 56 else | 52 else |
| 57 fail(); | 53 fail(); |
| 58 if (window.testRunner) | 54 if (window.testRunner) |
| 59 testRunner.notifyDone(); | 55 testRunner.notifyDone(); |
| 60 }, false); | |
| 61 | |
| 62 onload = function() | |
| 63 { | |
| 64 // Animation begins once we append the DOM node to the document. | |
| 65 var boxNode = document.createElement('div'); | |
| 66 boxNode.id = 'box'; | |
| 67 document.body.appendChild(boxNode); | |
| 68 } | 56 } |
| 69 </script> | 57 </script> |
| 70 </head> | 58 </head> |
| 71 <body> | 59 <body> |
| 72 Tests that unprefixed animation events are correctly fired when listeners are on
both versions. | 60 Tests that unprefixed animation events are correctly fired when using html event
listeners (only unprefixed should be fired). |
| 73 <pre id="result">FAIL: No animation events received</pre> | 61 <pre id="result">FAIL: No animation events received</pre> |
| 62 <div id="box" onwebkitanimationstart="recordPrefixedEvent();" onwebkitanimatione
nd="recordPrefixedEvent();" onwebkitanimationiteration="recordPrefixedEvent();"
onanimationstart="recordAnimationStart();" onanimationend="recordAnimationEnd();
" onanimationiteration="recordAnimationIteration();"></div> |
| 74 </body> | 63 </body> |
| 75 </html> | 64 </html> |
| OLD | NEW |