本文介绍了MooTools和jQuery集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的代码(1.11)和jQuery(1.2.6)。这是工作正常,当这些是
分开。在我整合Firefox时,它引发:

我的概念有什么问题吗?

$

  jQuery.noConflict();  


jQuery(function($){

$ jQuery here。
});
$在这里适用于MooTools。

但是,我建议你修改MooTools。



对所有对象原型的完全修改可能会导致jQuery的函数导致随机和不可解释的原因错误,而且最重要的是,MooTools对所有对象原型的修改(对象和函数原型甚至被修改)



此外,MooTools是50 KB,jQuery是25个,而且我的经验导致jQuery的执行速度明显慢于没有。 ; KB(平均数,包括扩展)。让它们都会极大地减慢页面加载,只是为了额外的数据提取。



我工作的项目遇到JavaScript性能问题,我在说真的 严重的减速,看起来很简单的代码。我们迁移到jQuery,并且在我们完成迁移代码后,我们停止加载MooTools,直到 没有性能增益,然后一旦我们删除了MooTools,速度就恢复了。


I am using the code MooTools (1.11) and jQuery (1.2.6). It's working fine when these areseparate. While I am integrating Firefox, it throws:

Is anything wrong in my concept? What do I do to rectify it?

解决方案
jQuery.noConflict();
jQuery(function($){

   $works with jQuery here.
});
$ Works with MooTools here.

However, that said, I would suggest you ditch the MooTools.

Its complete modification of all object prototypes can cause cause jQuery's functions to randomly and unexplainable cause errors, and on top of that, MooTools' modification of all object prototypes (the Object and Function prototypes are even modified), have, in my experience, resulted in jQuery performing significantly slower than without, simply for MooTools being on the same page.

Additionally, MooTools is 50 KB and jQuery is 25 KB (average numbers, including extensions). Having them both will drastically slow down page load just for the extra data fetch.

A project I was working was having problems with JavaScript performance, and I'm talking really serious slowdowns, in seemingly simple code. We migrated to jQuery, and there was no performance gain until we stopped loading the MooTools when we'd finished migrating the code, and then as soon as we dropped MooTools, the speed came back.

这篇关于MooTools和jQuery集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:25