| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Shorthand animation name ordering test</title> | 4 <title>Shorthand animation name ordering test</title> |
| 5 <style> | 5 <style> |
| 6 #box { | 6 #box { |
| 7 position: relative; | 7 position: relative; |
| 8 height: 100px; | 8 height: 100px; |
| 9 width: 100px; | 9 width: 100px; |
| 10 background-color: red; | 10 background-color: red; |
| 11 margin: 5px; | 11 margin: 5px; |
| 12 } | 12 } |
| 13 | 13 |
| 14 @-webkit-keyframes test { | 14 @keyframes test { |
| 15 from { left: 0px; } | 15 from { left: 0px; } |
| 16 to { left: 100px; } | 16 to { left: 100px; } |
| 17 } | 17 } |
| 18 | 18 |
| 19 @-webkit-keyframes backwards { | 19 @keyframes backwards { |
| 20 from { left: 0px; } | 20 from { left: 0px; } |
| 21 to { left: 100px; } | 21 to { left: 100px; } |
| 22 } | 22 } |
| 23 | 23 |
| 24 @-webkit-keyframes alternate { | 24 @keyframes alternate { |
| 25 from { left: 0px; } | 25 from { left: 0px; } |
| 26 to { left: 100px; } | 26 to { left: 100px; } |
| 27 } | 27 } |
| 28 | 28 |
| 29 @-webkit-keyframes linear { | 29 @keyframes linear { |
| 30 from { left: 0px; } | 30 from { left: 0px; } |
| 31 to { left: 100px; } | 31 to { left: 100px; } |
| 32 } | 32 } |
| 33 | 33 |
| 34 @-webkit-keyframes ease { | 34 @keyframes ease { |
| 35 from { left: 0px; } | 35 from { left: 0px; } |
| 36 to { left: 100px; } | 36 to { left: 100px; } |
| 37 } | 37 } |
| 38 </style> | 38 </style> |
| 39 <script> | 39 <script> |
| 40 | 40 |
| 41 const PROPERTIES_TO_TEST = [ | 41 const PROPERTIES_TO_TEST = [ |
| 42 "webkitAnimationName", | 42 "animationName", |
| 43 "webkitAnimationDuration", | 43 "animationDuration", |
| 44 "webkitAnimationTimingFunction", | 44 "animationTimingFunction", |
| 45 "webkitAnimationDelay", | 45 "animationDelay", |
| 46 "webkitAnimationIterationCount", | 46 "animationIterationCount", |
| 47 "webkitAnimationDirection", | 47 "animationDirection", |
| 48 "webkitAnimationFillMode" | 48 "animationFillMode" |
| 49 ]; | 49 ]; |
| 50 | 50 |
| 51 const DEFAULT_VALUES = [ | 51 const DEFAULT_VALUES = [ |
| 52 "none", | 52 "none", |
| 53 "0", | 53 "0", |
| 54 "ease", | 54 "ease", |
| 55 "0", | 55 "0", |
| 56 "1", | 56 "1", |
| 57 "normal", | 57 "normal", |
| 58 "none" | 58 "none" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 function runIndividualTest(testIndex) { | 98 function runIndividualTest(testIndex) { |
| 99 var result = document.getElementById("result"); | 99 var result = document.getElementById("result"); |
| 100 var element = document.getElementById("box"); | 100 var element = document.getElementById("box"); |
| 101 | 101 |
| 102 clearElementAnimationStyle(element); | 102 clearElementAnimationStyle(element); |
| 103 | 103 |
| 104 // Unfortunately need to force a style recalculation before testing. | 104 // Unfortunately need to force a style recalculation before testing. |
| 105 requestAnimationFrame(function () { | 105 requestAnimationFrame(function () { |
| 106 element.style.webkitAnimation = TEST_INPUTS[testIndex]; | 106 element.style.animation = TEST_INPUTS[testIndex]; |
| 107 | 107 |
| 108 // And another forced style recalculation. | 108 // And another forced style recalculation. |
| 109 requestAnimationFrame(function() { | 109 requestAnimationFrame(function() { |
| 110 var computedStyle = window.getComputedStyle(element); | 110 var computedStyle = window.getComputedStyle(element); |
| 111 | 111 |
| 112 for (var i=0; i < PROPERTIES_TO_TEST.length; i++) { | 112 for (var i=0; i < PROPERTIES_TO_TEST.length; i++) { |
| 113 var value = computedStyle[PROPERTIES_TO_TEST[i]]; | 113 var value = computedStyle[PROPERTIES_TO_TEST[i]]; |
| 114 if (value == EXPECTED_VALUES[testIndex][i]) | 114 if (value == EXPECTED_VALUES[testIndex][i]) |
| 115 result.innerHTML += "PASS Test " + (numTestsComplete + 1) +
": " + PROPERTIES_TO_TEST[i] + " was " + value + "<br>"; | 115 result.innerHTML += "PASS Test " + (numTestsComplete + 1) +
": " + PROPERTIES_TO_TEST[i] + " was " + value + "<br>"; |
| 116 else | 116 else |
| (...skipping 17 matching lines...) Expand all Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 window.addEventListener("load", runTests, false); | 136 window.addEventListener("load", runTests, false); |
| 137 </script> | 137 </script> |
| 138 </head> | 138 </head> |
| 139 <body> | 139 <body> |
| 140 <div id="box"></div> | 140 <div id="box"></div> |
| 141 <div id="result"></div> | 141 <div id="result"></div> |
| 142 </body> | 142 </body> |
| 143 </html> | 143 </html> |
| OLD | NEW |