} else {
var parts = rfxnum.exec(val),
- start = e.cur() || 0;
+ start = e.cur();
if ( parts ) {
var end = parseFloat( parts[2] ),
- unit = parts[3] || "px";
+ unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
return this.elem[ this.prop ];
}
- var r = parseFloat( jQuery.css( this.elem, this.prop ) );
- return r || 0;
+ var parsed,
+ r = jQuery.css( this.elem, this.prop );
+ // Empty strings, null, undefined and "auto" are converted to 0,
+ // complex values such as "rotate(1rad)" are returned as is,
+ // simple values such as "10px" are parsed to Float.
+ return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
this.startTime = jQuery.now();
this.start = from;
this.end = to;
- this.unit = unit || this.unit || "px";
+ this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
this.now = this.start;
this.pos = this.state = 0;
}
function defaultDisplay( nodeName ) {
- var stylesheets = document.styleSheets,
- disabled = [],
- elem, display;
-
if ( !elemdisplay[ nodeName ] ) {
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
+ display = elem.css("display");
- // #8099 - If the end-dev has globally changed a default
- // display, we can temporarily disable their styles to check
- // for the correct default value
- jQuery.each( stylesheets, function( idx, obj ) {
- disabled[ idx ] = obj.disabled;
- obj.disabled = true;
- });
-
- // Create a temp element and check it's default display
- elem = jQuery("<" + nodeName + ">").appendTo("body"),
- display = elem.css("display");
-
- // Remove temp element
elem.remove();
if ( display === "none" || display === "" ) {
display = "block";
}
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- // Restore stylesheets
- jQuery.each( stylesheets, function( idx, obj ) {
- this.disabled = disabled[ idx ];
- });
+ elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];