Make sure that height/width methods return numbers instead of strings.
[jquery.git] / src / css.js
index f921258..dd0ca4e 100644 (file)
@@ -66,16 +66,15 @@ jQuery.extend({
                                value += "px";
                        }
 
-                       if ( !("set" in hooks) || (value = hooks.set( elem, value )) === undefined ) {
+                       if ( !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
                                style[ name ] = value;
                        }
 
                } else {
-                       if ( "get" in hooks && (ret = hooks.get( elem, force, extra )) !== undefined ) {
+                       if ( !force && "get" in hooks && (ret = hooks.get( elem, force, extra )) !== undefined ) {
                                return ret;
-                       }
 
-                       if ( !force && style && style[ name ] ) {
+                       } else if ( !force && style[ name ] ) {
                                ret = style[ name ];
 
                        } else if ( curCSS ) {
@@ -214,14 +213,14 @@ function getWH( elem, name, extra ) {
 
        jQuery.each( which, function() {
                if ( !extra ) {
-                       val -= parseFloat(jQuery.css( elem, "padding" + this, undefined, true)) || 0;
+                       val -= parseFloat(jQuery.css( elem, "padding" + this, undefined, true )) || 0;
                }
 
                if ( extra === "margin" ) {
-                       val += parseFloat(jQuery.css( elem, "margin" + this, undefined, true)) || 0;
+                       val += parseFloat(jQuery.css( elem, "margin" + this, undefined, true )) || 0;
 
                } else {
-                       val -= parseFloat(jQuery.css( elem, "border" + this + "Width", undefined, true)) || 0;
+                       val -= parseFloat(jQuery.css( elem, "border" + this + "Width", undefined, true )) || 0;
                }
        });