X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=81a920b874e74fd2c395341c46e69bbbc5ab5fb7;hb=5d2be7e299131a31cffbd73edea59cde30445608;hp=50ad55d94ff292629dff8874019b3e154fa3c444;hpb=396dd2127330a7ed742d1e9092af54b668c46e85;p=jquery.git diff --git a/src/core.js b/src/core.js index 50ad55d..81a920b 100644 --- a/src/core.js +++ b/src/core.js @@ -438,18 +438,26 @@ jQuery.extend({ // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { - return toString.call(obj) === "[object Function]"; + return jQuery.type(obj) === "function"; }, isArray: function( obj ) { - return toString.call(obj) === "[object Array]"; + return jQuery.type(obj) === "array"; + }, + + type: function( obj ) { + return obj === null ? + "null" : + obj === undefined ? + "undefined" : + toString.call(obj).slice(8, -1).toLowerCase(); }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || obj.setInterval ) { return false; } @@ -595,7 +603,9 @@ jQuery.extend({ // The extra typeof function check is to prevent crashes // in Safari 2 (See: #3039) // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || typeof array === "function" || typeof array.setInterval !== "undefined" ) { + var type = jQuery.type(array); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || (typeof type !== "function" && array.setInterval) ) { push.call( ret, array ); } else { jQuery.merge( ret, array );