Skip to content
Permalink
Browse files
Optimized jQuery(Element) to not call jQuery() twice.
  • Loading branch information
jeresig committed Jul 11, 2009
1 parent bbf3334 commit fd2a2fe
Showing 1 changed file with 7 additions and 4 deletions.
@@ -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, $(...))

0 comments on commit fd2a2fe

Please sign in to comment.