Skip to main content

Bug Tracker

Side navigation

Ticket #7116: jquery.js.patch


File jquery.js.patch, 0.5 KB (added by trevorparscal, October 05, 2010 09:45PM UTC)

Adds robust integer parsing and conditionally defaults to zero if the result is NaN

Index: jquery.js
===================================================================
--- jquery.js	(revision 74316)
+++ jquery.js	(working copy)
@@ -6230,7 +6230,7 @@
 					jQuery.css( elem, type ) :
 
 					// Set the width or height on the element (default to pixels if value is unitless)
-					this.css( type, typeof size === "string" ? size : size + "px" );
+					this.css( type, typeof size === "string" ? size : ( parseInt( size ) || 0 ) + "px" );
 	};
 
 });

Download in other formats:

Original Format