]> source.dussan.org Git - jquery.git/commitdiff
Save a few bytes, thanks @danheberden!
authorDave Methvin <dave.methvin@gmail.com>
Tue, 16 Aug 2011 23:25:32 +0000 (19:25 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Tue, 16 Aug 2011 23:25:32 +0000 (19:25 -0400)
src/css.js

index da0dd20c8fca7105d358d3e16951e7d654d33287..e5a93fce1297c1bf81fc5c6ddc4788bbbd1eb0d8 100644 (file)
@@ -6,7 +6,7 @@ var ralpha = /alpha\([^)]*\)/i,
        rupper = /([A-Z]|^ms)/g,
        rnumpx = /^-?\d+(?:px)?$/i,
        rnum = /^-?\d/,
-       rrelNum = /^([+\-])=([+\-\.\de]+)/,
+       rrelNum = /^([-+])=([-+.\de]+)/,
 
        cssShow = { position: "absolute", visibility: "hidden", display: "block" },
        cssWidth = [ "Left", "Right" ],
@@ -85,7 +85,7 @@ jQuery.extend({
 
                        // convert relative number strings (+= or -=) to relative numbers. #7345
                        if ( type === "string" && (ret = rrelNum.exec( value )) ) {
-                               value = (ret[1] === "+"? +ret[2] : -ret[2]) + parseFloat( jQuery.css( elem, name ) );
+                               value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
                                // Fixes bug #9237
                                type = "number";
                        }