mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Fix #12191. jQuery.type should return "error" for Error objects.
This commit is contained in:
parent
78c1560065
commit
67df705bf5
@ -902,7 +902,7 @@ jQuery.ready.promise = function( obj ) {
|
||||
};
|
||||
|
||||
// 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();
|
||||
});
|
||||
|
||||
|
@ -250,7 +250,7 @@ test("trim", function() {
|
||||
});
|
||||
|
||||
test("type", function() {
|
||||
expect(23);
|
||||
expect( 24 );
|
||||
|
||||
equal( jQuery.type(null), "null", "null" );
|
||||
equal( jQuery.type(undefined), "undefined", "undefined" );
|
||||
@ -270,6 +270,7 @@ test("type", function() {
|
||||
equal( jQuery.type(new Date()), "date", "Date" );
|
||||
equal( jQuery.type(new Function("return;")), "function", "Function" );
|
||||
equal( jQuery.type(function(){}), "function", "Function" );
|
||||
equal( jQuery.type(new Error()), "error", "Error" );
|
||||
equal( jQuery.type(window), "object", "Window" );
|
||||
equal( jQuery.type(document), "object", "Document" );
|
||||
equal( jQuery.type(document.body), "object", "Element" );
|
||||
|
Loading…
Reference in New Issue
Block a user