Doesn't Mootools have some kind of equivalent to jQuery's 'noConflict'
method? In that way you don't need to overwrite the Magnolia $
function.

-- Hay
Internet developer, VPRO Digitaal

On Wed, Feb 17, 2010 at 3:09 PM, Matteo Pelucco
<matteo.pelu...@tinext.com> wrote:
>
> Hi all,
> I'm using Mootools as JS framework. Mootools is not scoped, so it defines $
> as a function. But it should not be a problem, because Magnolia defines its
> own $ function with these lines:
> *****************************
> if (typeof $ != 'function') {
>    function $(element)
>    {
>        return document.getElementById(element);
>    }
> }
> *****************************
>
> I'am a bit confused: this piece of code
>
> *****************************
> ...(head with mootools js declaration)
> <body ${bodyID} ${bodyClass}>
>
>        <script type="text/javascript">
>        alert($);
>        alert(typeof $);
>        </script>
>
>        [#-- add Magnolia css and js: --]
>       �...@cms.links /]
>
>        <script type="text/javascript">
>        alert($);
>        alert(typeof $);
>        </script>
> ...
> *****************************
>
> produced the following alert in IE7 // Chrome // Safari
>
> 1) <mootols $ function>
> 2) function
> 3) <magnolia $ function>
> 4) function
>
> but in Firefox
>
> 1) <mootols $ function>
> 2) function
> 3) <mootools $ function>
> 4) function
>
> Why this?
> The only way to let Magnolia & Mootols (but I think it is also with other
> $-based-not-scoped js libs) is to replace
>
> *****************************
> [#-- add Magnolia css and js: --]
> [...@cms.links /]
> *****************************
>
> with
>
> *****************************
> [#-- add Magnolia css and js: --]
> [...@cms.links /]
>
> [#-- Mootools 1.2.4 HACK, because Magnolia redefines $ function --]
> <script type="text/javascript">
> $ = function (a, b) {
>    return document.id(a, b, this.document);
> }
> </script>
> *****************************
>
>
> PS: why not use something like "mgnl" as $ replacement?
>
> Matteo
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com>
> ----------------------------------------------------------------
>
>

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to