No, this is not possible. MooTools is not self contained as jQuery or YUI
are. It enhances prototypes of things and uses the global namespace. Even if
you could put it in a closure, you would still not be able to use two
versions of it in the same page as both define native properties on arrays,
functions, etc.

On Wed, Sep 9, 2009 at 9:37 AM, rborn <[email protected]> wrote:

>
> Me again
> Fabio, can I isolate somehow the mootools lib and my code using a
> closure?
>
> If yes, can you give me some lines to follow ?
>
> Thanks
>
> On Sep 9, 2:58 pm, Fábio M. Costa <[email protected]> wrote:
> > You mean how can your script work with both versions?
> >
> > What i usually do is something like this:
> >
> > (function(){
> >   var $ = document.id || $;
> >
> >   // use $ here and it will work fine with 1.2.x
> >
> > })();
> >
> > At this example if the user has mootools 1.2.3 and jquery for example it
> > will get the document.id from mootools.
> > If he puts 1.2.2 and jquery it will get the dollar function from the last
> > framework he've put on the page, i think.
> >
> > This kind of make sure you'll have the mootools dollar function inside
> the
> > closure (if you use 1.2.3 or greater) while making it work fine with
> 1.2.2
> > or smaller (if the user doesn't put another framework on the site).
> >
> > --
> > Fábio Miranda Costa
> > Solucione Sistemas
> > Front-End Engineerhttp://meiocodigo.com
> >
> >
> >
> > On Wed, Sep 9, 2009 at 5:02 AM, rborn <[email protected]> wrote:
> >
> > > I want to upgrade Kroppr (http://kroppr.rborn.info) to mootools
> > > 1.2.3.
> > > This will allow me to simplify a lot the code, to be able to work with
> > > other frameworks.
> >
> > > My question is what is happening if the user already has a  version of
> > > mootools on it's page. How my script can break his, or in reverse
> >
> > > On Sep 9, 12:30 am, Fábio M. Costa <[email protected]> wrote:
> > > > If the developer uses 1.2.2 or smaller there will be no
> > > > document.idfunction, you should use the $ function instead.
> > > > If you want to use 1.2.3, just replace the old one with with 1.2.3.
> :S
> > > > It looks like you didnt asked what you really want.
> >
> > > > --
> > > > Fábio Miranda Costa
> > > > Solucione Sistemas
> > > > Front-End Engineerhttp://meiocodigo.com
> >
> > > > On Tue, Sep 8, 2009 at 7:15 PM, hellspawn <[email protected]>
> wrote:
> >
> > > > > Hi
> > > > > I want to take advantage of the last moo version -  the $ safe
> mode.
> > > > > What is happening if the user has allready an older version of
> > > > > mootools on it's site?
> > > > > thanks
>

Reply via email to