Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
c93b174b
Commit
c93b174b
authored
Mar 04, 2014
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Core: Arrays like [42] should fail .isNumeric()
Fixes #14179 (cherry picked from commit
10efa1f5
)
parent
a9fa2ec7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+3
-1
No files found.
src/core.js
View file @
c93b174b
...
@@ -216,7 +216,7 @@ jQuery.extend({
...
@@ -216,7 +216,7 @@ jQuery.extend({
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// subtraction forces infinities to NaN
return
obj
-
parseFloat
(
obj
)
>=
0
;
return
!
jQuery
.
isArray
(
obj
)
&&
obj
-
parseFloat
(
obj
)
>=
0
;
},
},
isEmptyObject
:
function
(
obj
)
{
isEmptyObject
:
function
(
obj
)
{
...
...
test/unit/core.js
View file @
c93b174b
...
@@ -462,7 +462,7 @@ test("isFunction", function() {
...
@@ -462,7 +462,7 @@ test("isFunction", function() {
});
});
test
(
"isNumeric"
,
function
()
{
test
(
"isNumeric"
,
function
()
{
expect
(
3
6
);
expect
(
3
8
);
var
t
=
jQuery
.
isNumeric
,
var
t
=
jQuery
.
isNumeric
,
Traditionalists
=
/** @constructor */
function
(
n
)
{
Traditionalists
=
/** @constructor */
function
(
n
)
{
...
@@ -510,6 +510,8 @@ test( "isNumeric", function() {
...
@@ -510,6 +510,8 @@ test( "isNumeric", function() {
equal
(
t
(
Number
.
NEGATIVE_INFINITY
),
false
,
"Negative Infinity"
);
equal
(
t
(
Number
.
NEGATIVE_INFINITY
),
false
,
"Negative Infinity"
);
equal
(
t
(
rong
),
false
,
"Custom .toString returning non-number"
);
equal
(
t
(
rong
),
false
,
"Custom .toString returning non-number"
);
equal
(
t
({}),
false
,
"Empty object"
);
equal
(
t
({}),
false
,
"Empty object"
);
equal
(
t
(
[]
),
false
,
"Empty array"
);
equal
(
t
(
[
42
]
),
false
,
"Array with one number"
);
equal
(
t
(
function
(){}
),
false
,
"Instance of a function"
);
equal
(
t
(
function
(){}
),
false
,
"Instance of a function"
);
equal
(
t
(
new
Date
()
),
false
,
"Instance of a Date"
);
equal
(
t
(
new
Date
()
),
false
,
"Instance of a Date"
);
equal
(
t
(
function
(){}
),
false
,
"Instance of a function"
);
equal
(
t
(
function
(){}
),
false
,
"Instance of a function"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment