Skip to content
Permalink
Browse files

Added a change that triples the speed of all uses of $(...). For exam…

…ple $(DOMElement) was 38ms, is now 13ms.
  • Loading branch information
jeresig committed Dec 10, 2007
1 parent ccf0550 commit f97f77c034dc62001a687c728bdfdc71a23bf6b8
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/core.js
@@ -14,10 +14,8 @@ if ( window.jQuery )
var _jQuery = window.jQuery;

var jQuery = window.jQuery = function( selector, context ) {
// If the context is a namespace object, return a new object
return this instanceof jQuery ?
this.init( selector, context ) :
new jQuery( selector, context );
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.prototype.init( selector, context );
};

// Map over the $ in case of overwrite
@@ -521,6 +519,9 @@ jQuery.fn = jQuery.prototype = {
}
};

// Give the init function the jQuery prototype for later instantiation
jQuery.prototype.init.prototype = jQuery.prototype;

function evalScript( i, elem ) {
if ( elem.src )
jQuery.ajax({

0 comments on commit f97f77c

Please sign in to comment.
You can’t perform that action at this time.