X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=585b200aec566b21bac9007416bc51e6aef9f2e5;hb=a78557472ce1c2cdf7db01a13fcc8591f3fdcfb0;hp=13efaec0c3e0d3a0cf2e48d1a0e25365a93638f9;hpb=04977b8ea2f9cbf786ae244a8b47aed67e37df7f;p=jquery.git diff --git a/src/core.js b/src/core.js index 13efaec..585b200 100644 --- a/src/core.js +++ b/src/core.js @@ -47,20 +47,16 @@ jQuery.fn = jQuery.prototype = { else { var elem = document.getElementById( match[3] ); - // Make sure an element was located - if ( elem ){ - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id != match[3] ) - return jQuery().find( selector ); - - // Otherwise, we inject the element directly into the jQuery object - var ret = jQuery( elem ); - ret.context = document; - ret.selector = selector; - return ret; - } - selector = []; + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem && elem.id != match[3] ) + return jQuery().find( selector ); + + // Otherwise, we inject the element directly into the jQuery object + var ret = jQuery( elem || [] ); + ret.context = document; + ret.selector = selector; + return ret; } // HANDLE: $(expr, [context])