[jquery-dev] Re: adding method to custom namespace

2009-03-29 Thread tres
Just to give a little insight, Howard had said that his way was 'dirty'. He was using $('div ul').myNamespace(). myMethod(). This isn't very dirty if you think about it, though. myNamespace() is a constructor just like jQuery(). In order to have access to 'this', you must be in object context. You

[jquery-dev] Re: adding method to custom namespace

2009-03-29 Thread tres
I've actually created a 'plugin' for authoring advanced plugins such as this. It allows for custom namespaces while still using 'this' inside them to refer to the jQuery object selection. On top of just namespaces, it also has methods to remove plugins, check to see if one exists and one for assi

[jquery-dev] Re: adding method to custom namespace

2009-03-28 Thread Balazs Endresz
Have a look at these: http://groups.google.com/group/jquery-dev/browse_thread/thread/b2f784b7575456dc/0cd276379f8a2f7d?show_docid=0cd276379f8a2f7d On Mar 28, 1:30 am, iceman2g wrote: > I asked this elsewhere and it was suggested that I ask here. > > So here goes > > I was curious if it's possibl

[jquery-dev] Re: adding method to custom namespace

2009-03-28 Thread Howard Rauscher
I tried to do something like this a couple of months ago, and you really can't do it efficiently. This method is the only real way to do it "$('div ul').myNamespace().myMethod();" And it is pretty messy. If you really wanted to do it this way "$('div ul').myNamespace.myMethod()," you would hav

[jquery-dev] Re: adding method to custom namespace

2009-03-28 Thread Julian Aubourg
I don't think it is possible. No matter how you turn it around, you'll lose the object context. I suppose your myNamespace() function is something like: $.fn.myNamespace = function() { return this; } right? 2009/3/28 iceman2g > > I asked this elsewhere and it was suggested that I ask here.