Commit f97f77c0 authored by John Resig's avatar John Resig

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

Added a change that triples the speed of all uses of $(...). For example $(DOMElement) was 38ms, is now 13ms.
parent ccf05503
......@@ -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({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment