This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($animate): ensure ms durations are properly rounded
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -865,6 +865,7 @@ angular.module('ngAnimate', ['ng']) | |
var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data'; | ||
var NG_ANIMATE_FALLBACK_CLASS_NAME = 'ng-animate-start'; | ||
var NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME = 'ng-animate-active'; | ||
var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; | ||
|
||
var lookupCache = {}; | ||
var parentCounter = 0; | ||
|
@@ -1118,14 +1119,19 @@ angular.module('ngAnimate', ['ng']) | |
event.stopPropagation(); | ||
var ev = event.originalEvent || event; | ||
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now(); | ||
|
||
/* Firefox (or possibly just Gecko) likes to not round values up | ||
* when a ms measurement is used for the animation */ | ||
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
caitp
Contributor
|
||
|
||
/* $manualTimeStamp is a mocked timeStamp value which is set | ||
* within browserTrigger(). This is only here so that tests can | ||
* mock animations properly. Real events fallback to event.timeStamp, | ||
* or, if they don't, then a timeStamp is automatically created for them. | ||
* We're checking to see if the timeStamp surpasses the expected delay, | ||
* but we're using elapsedTime instead of the timeStamp on the 2nd | ||
* pre-condition since animations sometimes close off early */ | ||
if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && ev.elapsedTime >= maxDuration) { | ||
if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { | ||
activeAnimationComplete(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I still think it's probably a good idea to file a bug about this, if this isn't the expected behaviour. I'm way too tired to dive into the CSS3 spec at the moment, so I'm not sure