On Sep 2, 9:48 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > From: R. Rajesh Jeba Anbiah
>
> >      I'm little confused with the architecture of jquery. I
> > tried to understand it with Firebug, but I'm lost as it's
> > just showing this tree.
>
> >     As far as I understand, $() creates a new jQuery object.
> > So, if we use $() many times, will it create as many objects
> > for it? TIA
>
> Yes.
   <snip>
>    function MyObject() {
>       if( this === window )
>          return new MyObject();
>    }
>
> This one gets a little more interesting. You can call MyObject as a
> constructor:
>
>    var myObject = new MyObject();
>
> Or you can leave out the "new" and it will do the exact same thing:
>
>    var myObject = MyObject();
>
> The "this === window" test catches the case of calling the function without
> the "new", and it does the "new" for you.
>
> If you look at the code for $()/jQuery(), you'll see that it calls "new
> jQuery" internally in this way, at line 19 of jquery-1.1.4.js.

   Many thanks for your great explanation. I think, I've got the idea.
I was thinking and had the opinion that creating many objects wouldn't
be a good idea. I also think, I've got the idea why the tinyMCE fails
with ready() 
http://groups.google.com/group/jquery-en/browse_thread/thread/6eb2442209953ebf

   Thanks again.

--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/

Reply via email to