I dont think it is possible Stephan. jquery core requires the plugin method
to be part of the $.fn (which is jQuery.prototype internally). This way
jQuery will be able to call the method in the context of the jquery object
itself. This is how we get "this" to represent the jQuery object itself. I
also wish there was a way to have our own namespaces. But atleast couldn't
find a working solution.

But if you wanted to create direct $.myPlugin plugins (like $.ajax). You can
have these in ur namespaces. Coz, there is no need for "this" reference
here.

-GTG

On 8/14/07, Stephan Beal <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 14, 4:05 pm, "Benjamin Sterling"
> <[EMAIL PROTECTED]> wrote:
> > Stephan,
> > I believe it is possible, M. Alsup does just that in is cycle plugin:
> http://malsup.com/jquery/cycle/jquery.cycle.all.js?v1.4
>
> That *almost* does what i'm looking for, but not quite. In that case,
> a single plugin uses child objects to hold the transitions. That is,
> in effect, a namespace in and of itself. But what i'm looking for is:
>
> $(...).malsup.cycle(...);
>
> Such that all of Malsup's plugins could be placed under the 'malsup'
> namespace.
>
> My initial attempts to do this in jQ have failed so far, e.g.:
>
> if( ! 'myns' in jQuery.fn ) {
>   jQuery.fn.myns = {};
> }
> jQuery.fn.myns.myPlugin = function(...){...};
>
> $(...).myns.myPlugin(...);
>
>
>

Reply via email to