Optimized jQuery(Element) to not call jQuery() twice.

This commit is contained in:
John Resig 2009-07-11 13:44:44 +00:00
parent bbf3334db1
commit fd2a2fed84

View file

@ -72,10 +72,13 @@ jQuery.fn = jQuery.prototype = {
}
// Otherwise, we inject the element directly into the jQuery object
ret = jQuery( elem || null );
ret.context = document;
ret.selector = selector;
return ret;
this.length = elem ? 1 : 0;
if ( elem ) {
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))