| 1312 | } |
| 1313 | |
| 1314 | function onAnimationProgress(event) { |
| 1315 | event.stopPropagation(); |
| 1316 | var ev = event.originalEvent || event; |
| 1317 | |
| 1318 | if (ev.target !== node) { |
| 1319 | // Since TransitionEvent / AnimationEvent bubble up, |
| 1320 | // we have to ignore events by finished child animations |
| 1321 | return; |
| 1322 | } |
| 1323 | |
| 1324 | // we now always use `Date.now()` due to the recent changes with |
| 1325 | // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) |
| 1326 | var timeStamp = ev.$manualTimeStamp || Date.now(); |
| 1327 | |
| 1328 | /* Firefox (or possibly just Gecko) likes to not round values up |
| 1329 | * when a ms measurement is used for the animation */ |
| 1330 | var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); |
| 1331 | |
| 1332 | /* $manualTimeStamp is a mocked timeStamp value which is set |
| 1333 | * within browserTrigger(). This is only here so that tests can |
| 1334 | * mock animations properly. Real events fallback to event.timeStamp, |
| 1335 | * or, if they don't, then a timeStamp is automatically created for them. |
| 1336 | * We're checking to see if the timeStamp surpasses the expected delay, |
| 1337 | * but we're using elapsedTime instead of the timeStamp on the 2nd |
| 1338 | * pre-condition since animationPauseds sometimes close off early */ |
| 1339 | if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { |
| 1340 | // we set this flag to ensure that if the transition is paused then, when resumed, |
| 1341 | // the animation will automatically close itself since transitions cannot be paused. |
| 1342 | animationCompleted = true; |
| 1343 | close(); |
| 1344 | } |
| 1345 | } |
| 1346 | |
| 1347 | function start() { |
| 1348 | if (animationClosed) return; |