mootools
There's yet another reason to master more than one JavaScript library: you can use some of them together! Since MooTools is prototype-based and jQuery is not, jQuery and MooTools may be used together on the same page.
掌握多个JavaScript库的另一个原因是:您可以将其中一些一起使用! 由于MooTools是基于原型的,而jQuery不是基于原型的,因此jQuery和MooTools可以在同一页面上一起使用。
XHTML和JavaScript (The XHTML and JavaScript)
jQuery sets this paragraph's color to red but MooTools sets the border color.
jQuery is namespaced so the $
function is free for MooTools to take hold of. The jQuery code passes jQuery to itself and then we call the argument $
, thus jQuery is contained, so to speak.
jQuery具有命名空间,因此$
功能免费供MooTools使用。 jQuery代码将jQuery传递给它自己,然后我们调用参数$
,因此可以说包含了jQuery。
Obviously including two libraries within the same page is resource-consuming but if it's acceptable to the project and allows you to implement plugins from each library quickly, this may be a great option for you.
显然,在同一页面中包含两个库很耗资源,但是如果项目可以接受并允许您快速实现每个库中的插件,那么这对您来说是个不错的选择。
翻译自:
mootools