| 1290 | } |
| 1291 | |
| 1292 | function onAnimationProgress(event) { |
| 1293 | event.stopPropagation(); |
| 1294 | var ev = event.originalEvent || event; |
| 1295 | |
| 1296 | if (ev.target !== node) { |
| 1297 | // Since TransitionEvent / AnimationEvent bubble up, |
| 1298 | // we have to ignore events by finished child animations |
| 1299 | return; |
| 1300 | } |
| 1301 | |
| 1302 | // we now always use `Date.now()` due to the recent changes with |
| 1303 | // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) |
| 1304 | var timeStamp = ev.$manualTimeStamp || Date.now(); |
| 1305 | |
| 1306 | /* Firefox (or possibly just Gecko) likes to not round values up |
| 1307 | * when a ms measurement is used for the animation */ |
| 1308 | var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); |
| 1309 | |
| 1310 | /* $manualTimeStamp is a mocked timeStamp value which is set |
| 1311 | * within browserTrigger(). This is only here so that tests can |
| 1312 | * mock animations properly. Real events fallback to event.timeStamp, |
| 1313 | * or, if they don't, then a timeStamp is automatically created for them. |
| 1314 | * We're checking to see if the timeStamp surpasses the expected delay, |
| 1315 | * but we're using elapsedTime instead of the timeStamp on the 2nd |
| 1316 | * pre-condition since animationPauseds sometimes close off early */ |
| 1317 | if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { |
| 1318 | // we set this flag to ensure that if the transition is paused then, when resumed, |
| 1319 | // the animation will automatically close itself since transitions cannot be paused. |
| 1320 | animationCompleted = true; |
| 1321 | close(); |
| 1322 | } |
| 1323 | } |
| 1324 | |
| 1325 | function start() { |
| 1326 | if (animationClosed) return; |