Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions js/jquery.mobile.animationComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ define( [

// All lower case if not a vendor prop
if ( props[ test ][ "prefix" ] === "" ) {
props[ test ][ "duration" ] = props[ test ][ "duration" ].toLowerCase();
props[ test ][ "event" ] = props[ test ][ "event" ].toLowerCase();
}
});
Expand Down Expand Up @@ -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 ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose an extra safeguard cant hurt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

duration = $.fn.animationComplete.default;
duration = $.fn.animationComplete.defaultDuration;
}
}

Expand All @@ -98,7 +98,7 @@ define( [
};

// Allow default callback to be configured on mobileInit
$.fn.animationComplete.default = 1000;
$.fn.animationComplete.defaultDuration = 1000;
})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
});
Expand Down