AnimationComplete: change default to durationDefault fix duration read #7119

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Owner

arschmitz commented Feb 17, 2014

Safegurard against NAN values and fix camelcase of duration name

Fixes gh-7114
Fixes gh-7118

@arschmitz arschmitz AnimationComplete: change default to durationDefault fix duration read
Safegurard against NAN values and fix camelcase of duration name

Fixes gh-7114
Fixes gh-7118
4a4a2cb

@gabrielschulhof gabrielschulhof commented on the diff Feb 17, 2014

js/jquery.mobile.animationComplete.js
@@ -64,14 +63,15 @@ define( [
// Parse the durration since its in second multiple by 1000 for milliseconds
// Multiply by 3 to make sure we give the animation plenty of time.
- duration = parseFloat(
- $( this ).css( props[ animationType ].duration )
- ) * 3000;
+ duration = $( this ).css( props[ animationType ].duration );
+ if ( duration !== undefined ) {
+ duration = parseFloat( duration ) * 3000;
+ }
}
// If we could not read a duration use the default
if ( duration === 0 || duration === undefined ) {
@gabrielschulhof

gabrielschulhof Feb 17, 2014

Contributor

... maybe add || isNaN( duration ) anyway, in case the duration-as-a-string was defined, but contained garbage ... ?

@arschmitz

arschmitz Feb 17, 2014

Owner

i suppose an extra safeguard cant hurt

@gabrielschulhof

gabrielschulhof Feb 18, 2014

Contributor

Actually, if you add this condition, you don't really need to check if duration is undefined before passing it into parseFloat(), because

parseFloat( undefined ) => NaN
parseFloat( "" ) => NaN
Contributor

gabrielschulhof commented Feb 17, 2014

The commit message should say it Fixes gh-7116 instead of gh-7118, which is my PR. IOW:

Safegurard against NAN values and fix camelcase of duration name

Fixes gh-7114
Fixes gh-7116

arschmitz closed this in 5bbb46a Feb 18, 2014

arschmitz deleted the animation-complete-fixes branch Jul 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment