Skip to content

Commit d386b7a

Browse files
matskopetebacondarwin
authored andcommittedJan 5, 2016
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 angular#13494 for more info. Applies to 1.2, 1.3, 1.4 and 1.5. Closes angular#13494 Closes angular#13495
1 parent ebc5a47 commit d386b7a

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
@@ -1956,15 +1956,15 @@ angular.module('ngAnimate', ['ng'])
19561956
function onAnimationProgress(event) {
19571957
event.stopPropagation();
19581958
var ev = event.originalEvent || event;
1959-
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
1959+
var timeStamp = ev.$manualTimeStamp || Date.now();
19601960

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.