开发者

mootools and prototype conflict

开发者 https://www.devze.com 2023-03-23 19:32 出处:网络
this is my code it keeps not work , if i remove the prototype script file , mootools work and if i remove the mootools prototype works !! this is code :

this is my code it keeps not work , if i remove the prototype script file , mootools work and if i remove the mootools prototype works !! this is code :

<script type="text/javascript" src="js/mootools.js"></script> 
<script type="text/javascript" src="js/imageMenu.js"></script> 
<script type="text/javascript" src="js/prototype.js"></script>

<script type="text/javascript">

     开发者_如何学C       window.addEvent('domready', function(){
                var myMenu = new ImageMenu($$('#imageMenu a'),{openWidth:310, border:2, onOpen:function(e,i){alert(e);}});
            });
</script>

Its important to mention that when i try once , prototype worked together with MT but Ajax.Updater in prototype still not work .

i did check most of topics here about the problem but still lose !


I am not sure why you'd even want to use prototype and mootools together. This would certainly qualify as misuse of frameworks... pick ONE and stick with it. If you can't choose between one or the other, start with the base assumption that you even need a framework at all, then decide from there which one suits your needs. Using one (or several) simply for the sake of having it is a bad plan.

Both frameworks accomplish their functionality by extending DOM, so it isn't a surprise that there are conflicts. Both use $ as an entry point for their extended functionality. The amount of functionality duplication you get when you stack frameworks nearly precludes using them in conjunction, never mind the additional overhead in loading tons of code you don't need.

All that said, you can check out this article. This is mootools' recommendation for compatibility/conflict resolution with other frameworks. You will note that in the first paragraph of the article, the author gives the same warning I have here - don't stack frameworks. There are very few, highly specific circumstances where this is your only choice, otherwise you seriously need to consider why you're taking this approach.

0

精彩评论

暂无评论...
验证码 换一张
取 消