Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 8d83b56

Browse files
matskopetebacondarwin
authored andcommitted
fix(ngAnimate): do not use event.timeStamp anymore for time tracking
Due to recent changes in Chrome, Firefox and Webkit use of the event.timeStamp value will lead to unpredictable behaviour due to precision changes. Therefore it's best to stick entirely to use `Date.now()` when it comes to confirming the end of transition- ending values. See #13494 for more info. Applies to 1.2, 1.3, 1.4 and 1.5. Closes #13494 Closes #13495
1 parent b31234e commit 8d83b56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ngAnimate/animate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1486,15 +1486,15 @@ angular.module('ngAnimate', ['ng'])
14861486
function onAnimationProgress(event) {
14871487
event.stopPropagation();
14881488
var ev = event.originalEvent || event;
1489-
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
1489+
var timeStamp = ev.$manualTimeStamp || Date.now();
14901490

14911491
/* Firefox (or possibly just Gecko) likes to not round values up
14921492
* when a ms measurement is used for the animation */
14931493
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
14941494

14951495
/* $manualTimeStamp is a mocked timeStamp value which is set
14961496
* within browserTrigger(). This is only here so that tests can
1497-
* mock animations properly. Real events fallback to event.timeStamp,
1497+
* mock animations properly. Real events fallback to Date.now(),
14981498
* or, if they don't, then a timeStamp is automatically created for them.
14991499
* We're checking to see if the timeStamp surpasses the expected delay,
15001500
* but we're using elapsedTime instead of the timeStamp on the 2nd

0 commit comments

Comments
 (0)