diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 4 | ||||
-rw-r--r-- | src/css.js | 2 | ||||
-rw-r--r-- | src/data.js | 2 | ||||
-rw-r--r-- | src/dimensions.js | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/core.js b/src/core.js index 7f30edea2..e28c1b524 100644 --- a/src/core.js +++ b/src/core.js @@ -483,8 +483,8 @@ jQuery.extend({ return obj && typeof obj === "object" && "setInterval" in obj; }, - isNaN: function( obj ) { - return obj == null || !rdigit.test( obj ) || isNaN( obj ); + isNumeric: function( obj ) { + return obj != null && rdigit.test( obj ) && !isNaN( obj ); }, type: function( obj ) { diff --git a/src/css.js b/src/css.js index 76c2255ce..2adfdffe1 100644 --- a/src/css.js +++ b/src/css.js @@ -211,7 +211,7 @@ if ( !jQuery.support.opacity ) { set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, - opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")", + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout diff --git a/src/data.js b/src/data.js index 0ce3b7d66..02f96a849 100644 --- a/src/data.js +++ b/src/data.js @@ -323,7 +323,7 @@ function dataAttr( elem, key, data ) { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : - !jQuery.isNaN( data ) ? parseFloat( data ) : + jQuery.isNumeric( data ) ? parseFloat( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} diff --git a/src/dimensions.js b/src/dimensions.js index 7df0d5ddf..d339817c9 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -61,7 +61,7 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { var orig = jQuery.css( elem, type ), ret = parseFloat( orig ); - return jQuery.isNaN( ret ) ? orig : ret; + return jQuery.isNumeric( ret ) ? ret : orig; // Set the width or height on the element (default to pixels if value is unitless) } else { |