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
67df705b
Commit
67df705b
authored
Nov 24, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12191. jQuery.type should return "error" for Error objects.
parent
78c15600
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
core.js
src/core.js
+1
-1
core.js
test/unit/core.js
+2
-1
No files found.
src/core.js
View file @
67df705b
...
@@ -902,7 +902,7 @@ jQuery.ready.promise = function( obj ) {
...
@@ -902,7 +902,7 @@ jQuery.ready.promise = function( obj ) {
};
};
// Populate the class2type map
// Populate the class2type map
jQuery
.
each
(
"Boolean Number String Function Array Date RegExp Object"
.
split
(
" "
),
function
(
i
,
name
)
{
jQuery
.
each
(
"Boolean Number String Function Array Date RegExp Object
Error
"
.
split
(
" "
),
function
(
i
,
name
)
{
class2type
[
"[object "
+
name
+
"]"
]
=
name
.
toLowerCase
();
class2type
[
"[object "
+
name
+
"]"
]
=
name
.
toLowerCase
();
});
});
...
...
test/unit/core.js
View file @
67df705b
...
@@ -250,7 +250,7 @@ test("trim", function() {
...
@@ -250,7 +250,7 @@ test("trim", function() {
});
});
test
(
"type"
,
function
()
{
test
(
"type"
,
function
()
{
expect
(
23
);
expect
(
24
);
equal
(
jQuery
.
type
(
null
),
"null"
,
"null"
);
equal
(
jQuery
.
type
(
null
),
"null"
,
"null"
);
equal
(
jQuery
.
type
(
undefined
),
"undefined"
,
"undefined"
);
equal
(
jQuery
.
type
(
undefined
),
"undefined"
,
"undefined"
);
...
@@ -270,6 +270,7 @@ test("type", function() {
...
@@ -270,6 +270,7 @@ test("type", function() {
equal
(
jQuery
.
type
(
new
Date
()),
"date"
,
"Date"
);
equal
(
jQuery
.
type
(
new
Date
()),
"date"
,
"Date"
);
equal
(
jQuery
.
type
(
new
Function
(
"return;"
)),
"function"
,
"Function"
);
equal
(
jQuery
.
type
(
new
Function
(
"return;"
)),
"function"
,
"Function"
);
equal
(
jQuery
.
type
(
function
(){}),
"function"
,
"Function"
);
equal
(
jQuery
.
type
(
function
(){}),
"function"
,
"Function"
);
equal
(
jQuery
.
type
(
new
Error
()),
"error"
,
"Error"
);
equal
(
jQuery
.
type
(
window
),
"object"
,
"Window"
);
equal
(
jQuery
.
type
(
window
),
"object"
,
"Window"
);
equal
(
jQuery
.
type
(
document
),
"object"
,
"Document"
);
equal
(
jQuery
.
type
(
document
),
"object"
,
"Document"
);
equal
(
jQuery
.
type
(
document
.
body
),
"object"
,
"Element"
);
equal
(
jQuery
.
type
(
document
.
body
),
"object"
,
"Element"
);
...
...
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