Possible Duplicate:
Why jQuery do this: jQuery.fn.init.prototype = jQuery.fn?
I am reading through the jquery source and am confused early on. As it is, the jQuery function returns a "new jQuery.fn.init(selector,context);". Then jQuery.fn = jQuery.prototype, which contains the init function. Finally, jQuery.fn.init.prototype = jQuery.fn.
Main question: Why did the designers not just have the jQuery function return "new jQuery.fn(selector,context)" and have init and the other functions in jQuery.prototype (i.e. jQuery.fn) be in jQuery.fn.prototype?
Secondary concern: I don't see the point in setting jQuery.prototype at all considering you never call "new jQuery(s,c)"... the jQuery (i.e. $) object is just a wrapper on jQuery.fn to hide calling "new" in code, since it is prettier to say "$('div').foo()" than "new $('div').foo()"