| 1265 | } |
| 1266 | |
| 1267 | function onAnimationProgress(event) { |
| 1268 | event.stopPropagation(); |
| 1269 | var ev = event.originalEvent || event; |
| 1270 | var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now(); |
| 1271 | |
| 1272 | /* Firefox (or possibly just Gecko) likes to not round values up |
| 1273 | * when a ms measurement is used for the animation */ |
| 1274 | var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); |
| 1275 | |
| 1276 | /* $manualTimeStamp is a mocked timeStamp value which is set |
| 1277 | * within browserTrigger(). This is only here so that tests can |
| 1278 | * mock animations properly. Real events fallback to event.timeStamp, |
| 1279 | * or, if they don't, then a timeStamp is automatically created for them. |
| 1280 | * We're checking to see if the timeStamp surpasses the expected delay, |
| 1281 | * but we're using elapsedTime instead of the timeStamp on the 2nd |
| 1282 | * pre-condition since animations sometimes close off early */ |
| 1283 | if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { |
| 1284 | // we set this flag to ensure that if the transition is paused then, when resumed, |
| 1285 | // the animation will automatically close itself since transitions cannot be paused. |
| 1286 | animationCompleted = true; |
| 1287 | close(); |
| 1288 | } |
| 1289 | } |
| 1290 | } |
| 1291 | } |
| 1292 | }]; |