First, Fabio, no one needs to name $ to document.id to upgrade UNLESS they
have another script that's using $ (like jQuery). That's not the case here.
Dan (I think that's your name, forgive me if not), your site is running on a
*very* old version of MooTools. You'll need to upgrade. Upgrading is not a
painless process as the API for the framework has changed. I *think* you're
running a 1.0 version of MooTools; I can't tell, because back then we didn't
put the version number in the download. You'll need to download MooTools 1.2
and replace your copy of MooTools with it. You'll then need to go through
your code and rewrite the portions of it that need to change.

To help with this, you can use this compatibility layer:

http://gist.github.com/128335

If you include this after mootools
1.2 but before your code, it will post console warnings to you in
firebug in all the places you're using deprecated methods. You should
NOT leave this script in place in production. It's only there to help
you upgrade.

Good luck.

2009/9/9 Fábio M. Costa <[email protected]>

> 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 Engineer
> http://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