I got two questions about following code snippet.
(1). What is the purpose of "return new jQuery.fn.init( selector, context, rootjQuery );"? Why does it return another instance inside the JQuery function?
(2). Why prototype.constructor is re-defined as JQuery?
// Define a local copy of jQuery
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 ) {
var match, elem, ret, doc;
Thank you!