(function(window, undefined) { // Define a local copy of jQuery var jQuery = (function() { var jQuery = function(selector, context) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init(selector, context/*, rootjQuery*/); }; // ... jQuery.fn = jQuery.prototype = { constructor : jQuery, init : function(selector, context, rootjQuery) { // ... } // ... }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; // ... // Expose jQuery to the global object return jQuery; })(); // ... window.jQuery = window.$ = jQuery; })(window);