you cant use the prototypejs framework together with mootools, as they both extend the Natives (Array, Number, String, ...)

search the group for longer discussions about compatibility with other libraries. (YUI for example works with other libraries, including mootools).

jan


On Oct 15, 2008, at 17:24, Nir Tayeb wrote:


MooTools is my framework of choice and i love using it, but i realize
that i wrong in choosing it to my current project, and I can't return
back. My script need to be placed in clients sites, and some of the
client use prototype in their page.

so i renamed a lot of function of Arrays, Hashes, Elements and such so
it can be run together. But one big problem is remained: Internet
Explorer and window.Element which uses as legacy in the Native Element
creation:
-------------------------------------------------------------------------------------------------------
var Element = new Native({

        name: 'Element',

        legacy: window.Element,       // solution #2 - comment this line out.

        initialize: function(tag, props){
                var konstructor = Element.Constructors.mooGet(tag);
                if (konstructor) return konstructor(props);
                if (typeof tag == 'string') return document.newElement(tag, 
props);
                return $el(tag).set(props);
        },

        afterImplement: function(key, value){
                if (!Array[key]) Elements.implement(key, Elements.multi(key));
                Element.Prototype[key] = value;
        }

});
-------------------------------------------------------------------------------------------------------

If prototype runs before MooTools the window.Element is filled with
{}  with this line of prototype:
if (!window.Element) var Element = {};

so Internet Explorer now has window.Element and MooTools's Native
constructor try to use its prototype, so error occurred - {}.prototype
is null:
mootools code:
if (legacy && initialize) object.prototype = legacy.prototype


So i've 2 solutions for this problem:
1. Tell to clients to put my script before prototype, so
window.Element is null when MooTools running, and Prototype just
extends it after, and not override it.
But my boss don't like this solution so much.

2. Comment the legacy declaration from the code above, but i don't
know what the influences of this.

and my question is what the influences of using solution #2 ?

thanks, Nir Tayeb.

--
my blog: http://blog.kassens.net

Reply via email to