X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fcore.js;h=f5c27561b2fc44a0297f3cbc5611df3d1713f15a;hb=13f27fcd05987dc8951621ea55795fde792d7b79;hp=7fa20d4958b22a7ea37b0aa205611128ed157bed;hpb=18dad474891b94c2f51083cb9df8860a84d630b0;p=jquery.git diff --git a/src/core.js b/src/core.js index 7fa20d4..f5c2756 100644 --- a/src/core.js +++ b/src/core.js @@ -119,7 +119,9 @@ jQuery.fn = jQuery.prototype = { } else { elem = document.getElementById( match[2] ); - if ( elem ) { + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { @@ -438,18 +440,24 @@ 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]"; + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + 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,9 +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 - var type = toString.call(array); + var type = jQuery.type(array); - if ( array.length == null || type === "[object String]" || type === "[object Function]" || type === "[object RegExp]" || (typeof type !== "function" && array.setInterval) ) { + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || "setInterval" in array ) { push.call( ret, array ); } else { jQuery.merge( ret, array );