4) join the dev list and try to read up as a discussion progresses even if you don't reply
it basically starts to give you a little perspective on issues. sometimes they are hot, sometimes they are not. but the topic always provides some insight on jquery and it's on-going development process. On May 5, 11:59 pm, chris thatcher <thatcher.christop...@gmail.com> wrote: > i would recommend studying jquery.collections by ariel flesler. > > http://flesler.blogspot.com/2008/01/jquerycollection.html > > i recommend this for several reasons: > > 1) it's a plugin - understanding plugins is part of the core architectural > pattern. > > 2) it mimicks jquery's core architecture - a collection is a jquery-ish > object. so you will understand why the jquery object is both a static object > with it's own methods, and how those are reused on the jquery instance, > which an array-like object with its own scope of > functions like the jquery > > 3) it may teach you how to use namespace (or named closure) > > jquery uses this anonymous function pattern heavily. so do good plugins. > > <pre> > jQuery.noConflict(); > //anonymous function executed at load time > (function($){ > //$ is jQuery})(jQuery);//semi colon should be included > > //$ is not jQuery > </pre> > > you can create the same pattern with a plugin that uses an additional > namesapce to prevent pollution on the jquery namespace: > > <pre> > jQuery.noConflict(); > //anonymous function executed at load time > (function($, _){ > //$ is jQuery > //_ is MyNamespace})(jQuery, MyNamespace);//semi colon should be included > > //$ is not jQuery > </pre> > > > > On Tue, May 5, 2009 at 11:40 PM, Matt Kruse <m...@thekrusefamily.com> wrote: > > > On May 5, 5:36 pm, kiusau <kiu...@mac.com> wrote: > > > It helps enormously, as well as everything that came before it. > > > Glad it helped. Anyone can feel free to paraphrase what I wrote and > > wiki it if you wish ;) > > > > What > > > alert($) returns, however, is the following: > > > function (selector, context) { > > > return new (jQuery.fn.init)(selector, context); > > > } > > > In some browsers. > > > > I also > > > understand that methods and properties are pretty much treated the > > > same by the object in which they are contained. > > > Yes, methods are always object properties. > > > > What I do not > > > understand is why jQuery.fn.init is not written as jQuery.fn.init() > > > where init() is a method of the jQuery.fn prototype object. > > > First, I do notice that FF alerts what you have written, yet IE does > > not. Doesn't matter how they are represented internally, though, > > because they are the same thing. In the actual source, the code is: > > > function( selector, context ) { > > // The jQuery object is actually just the init constructor > > 'enhanced' > > return new jQuery.fn.init( selector, context ); > > } > > > Since > > jQuery.fn.init === (jQuery.fn.init) > > then either representation means the same thing. > > > Now, as for why "init" is a property of the jQuery.fn (aka > > jQuery.prototype) object and then its prototype set to jQuery.fn > > itself, I don't know. Seems like an odd coding decision to me, but > > perhaps there is some reasoning behind it? I would be curious to know. > > Separating out the init() method to just a stand-alone constructor > > function called jQuery() works fine and would seem cleaner. > > > Any other questions? :) > > > Matt Kruse > > -- > Christopher Thatcher