aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2013-09-05 14:04:11 -0400
committerRichard Gibson <richard.gibson@gmail.com>2013-09-12 16:45:12 -0400
commit68213f20bb5d5426f99bafde028ecab601a9d105 (patch)
treeb6be3db335d6ae08aa205288e8e9a4e886ef17a0 /src/core.js
parent1d57ffe5fff06928aac53813342d33ec6bddd531 (diff)
downloadjquery-68213f20bb5d5426f99bafde028ecab601a9d105.tar.gz
jquery-68213f20bb5d5426f99bafde028ecab601a9d105.zip
Ref #14313: NaN detection. Close gh-1352.
(cherry picked from commit 0bc0a69026ce4c1ac570a729d3c975a4a55d0ff4)
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core.js b/src/core.js
index 599caba64..0a8ba3893 100644
--- a/src/core.js
+++ b/src/core.js
@@ -221,7 +221,10 @@ jQuery.extend({
},
isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ // parseFloat NaNs numeric-cast false positives (null|true|false|"")
+ // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
+ // subtraction forces infinities to NaN
+ return obj - parseFloat( obj ) >= 0;
},
type: function( obj ) {