热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文



I just inherited some web pages which uses MooTools. I never used MooTools. Now I need to add some functions on the page, I wonder if it's a good idea to use jquery and mooTools on the same page?


Basically, I have 3 options,


  1. Convert the pages to JQuery, which I have to learn MooTools to do that.
  2. 将页面转换为JQuery,我必须学习MooTools才能做到这一点。

  3. Write new functions in MooTools. I have to learn even more MooTools to achieve this.
  4. 在MooTools中编写新功能。我必须学习更多的MooTools来实现这一目标。

  5. Use both on the page.
  6. 在页面上同时使用两者。

Your opinion will be appreciated.


10 个解决方案



Opinion: Learn MooTools and then move on with it. Sounds like a great opportunity to learn something new. Why introduce an entirely new library with addition js bloat if you don't need to. If it'll solve the problem you're golden.




MooTools is a perfectly solid and acceptable Javascript library and I'd recommend you add it to your list of known technologies rather than tear it out and replace with JQuery. Mixing the two is not a good idea as you're likely to encounter obscure difficult to debug conflicts.


JQuery has had all the press of late, but it's by no means cut and dried that it beats every other library hands-down. Far from it. You might even find you prefer MooTools :-)

JQuery最近收到了所有的报道,但它并没有削减和干涸,它击败了其他所有图书馆。离得很远。您甚至可能会发现您更喜欢MooTools :-)

ADDED: For what it's worth my personal experience is that MooTools seems to play alongside other Javascript code more nicely than jQuery. I've been handling several sites of late which have mixed in MooTools with various other pieces of Javascript for different effects/functionality and it's all seemed to play along together with minimal issues. OTOH pages that use jQuery tend to use jQuery versions of everything. YMMV of course.

添加:值得我个人经验的是,MooTools似乎与jQuery相比更好地与其他Javascript代码一起使用。我一直在处理几个已经混合了MooTools的网站,其中包含各种其他Javascript的不同效果/功能,它们似乎与最小的问题一起发挥。使用jQuery的OTOH页面倾向于使用jQuery版本的所有内容。 YMMV当然。



Personally, I'd recommend not using both, as there are strange conflicts, even with jQuery.noConflict(). Go with one or the other.


If you do end up using both, be sure to use jQuery.noConflict() to ensure that using the $ doesn't conflict.


Using jQuery with Other Libraries




i'd say, depends on how the code is structured and what you need to do. mootools does render itself to easy refactoring and extending (this is, after all, partly the reason it exists) but it takes a while to figure best practices and so forth.

我会说,取决于代码的结构以及您需要做什么。 mootools确实使自己易于重构和扩展(毕竟,这部分是它存在的原因)但是需要一段时间来计算最佳实践等等。

however, your learning curve from vanilla Javascript or jquery won't be too steep, especially so if all you care about is DOM mantipulation, event handling and effects. things get more interesting when you decide to write / extend mootools classes and venture into prototyping - but you may not have to do that...

然而,你的vanilla Javascript或jquery的学习曲线不会太陡峭,尤其如此,如果你关心的只是DOM的人为因素,事件处理和效果。当你决定编写/扩展mootools类并冒险进行原型设计时,事情变得更有趣 - 但你可能不必这样做......

there are some pretty good tutorials around for most things as well as some demos on doing things through jquery and mootools (equivalent ones). http://jqueryvsmootools.com/ is a good example on how the same task can be done through either one, i'd recommend reading it before deciding.

对于大多数事情都有一些非常好的教程,以及一些通过jquery和mootools(等效的)做事的演示。 http://jqueryvsmootools.com/是关于如何通过任何一个完成相同任务的一个很好的例子,我建议在决定之前阅读它。

whatever you decide, it is a bad practice to use two frameworks (when you can do without).




It depends on how big a project it would be to convert to jQuery, how much of your job is maintaing these pages (vs other pages that already use jQuery), what the urgency is for your first set of changes, etc...


It comes down to a cost comparison: how does the cost to your business to convert them to jQuery compare to the cost to the business for you to learn mooTools (and maybe keep both mootools and jquery in your head at the same time).


The only thing I can say for sure is don't do option 3. This isn't necessarily because it you can't make it work (and there will be challenges), but because you'll have to learn mootools to properly maintain the pages anyway. Once you do that, you may as well just keep them mootools rather than re-write everything or try to mix frameworks.


Personally I'm inclined to say convert it jQuery, since I believe jQuery is eventually going to corner the market. The implication then is that it will convert to jQuery at some point, and so the long term costs to business are probably best optimized by doing the conversion earlier while there's less to convert and mootools is still relevant so you can easily get help with the conversion. But that's certainly arguable.




jQuery and Mootools basics are close enough that moving from one to the other isn't much of a headache.


Whenever I'm given the choice between the two, I lean towards Mootools - especially if I'm intending to do any sort of effects or animations. Mootools's base FX libraries are far more robust and generate better results cross-browser in my experience.

每当我在两者之间做出选择时,我倾向于Mootools - 特别是如果我打算做任何类型的效果或动画。根据我的经验,Mootools的基本FX库更加强大,并且可以跨浏览器生成更好的结果。

Like others have suggested, you could take this opportunity as a learning experience. If you're satisfied with jQuery and don't feel the need to learn another framework, port the code over. You can't really go wrong with either in the end.




Since you're more comfortable with jQuery, I would just call jQuery.noConflict(); first thing, and write the functions in jQuery. That is, of course, if time is a factor.




There is a project that twists and prods Mootools to make it look like JQuery (a wolf in a sheep's clothing... or a golden coin painted to look like silver...)


I certainly think you should learn Mootools, but that might help.




I agree with those that are in favor of learning mootols, but i think that is even better if your take that decision because you finally think that learning mootools worth it.


So i think it would be nice to have some research over mootools capabilities.


I like this articule about this subject. And I think it can be useful for those reading this thread.





I wrote a blog post about running the 2 side by side. http://chrisbarba.wordpress.com/2009/12/30/need-to-run-jq…s-side-by-side/

我写了一篇关于并排运行2的博客文章。 http://chrisbarba.wordpress.com/2009/12/30/need-to-run-jq...s-side-by-side/

I had no trouble getting it work in a SharePoint site. Chris


  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • IhaveawebapplicationthatusesanActiveXCOMcomponent,forexample:我有一个使用ActiveXCOM组件的Web应用程 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • Webmin远程命令执行漏洞复现及防护方法
    本文介绍了Webmin远程命令执行漏洞CVE-2019-15107的漏洞详情和复现方法,同时提供了防护方法。漏洞存在于Webmin的找回密码页面中,攻击者无需权限即可注入命令并执行任意系统命令。文章还提供了相关参考链接和搭建靶场的步骤。此外,还指出了参考链接中的数据包不准确的问题,并解释了漏洞触发的条件。最后,给出了防护方法以避免受到该漏洞的攻击。 ... [详细]
  • 拥抱Android Design Support Library新变化(导航视图、悬浮ActionBar)
    转载请注明明桑AndroidAndroid5.0Loollipop作为Android最重要的版本之一,为我们带来了全新的界面风格和设计语言。看起来很受欢迎࿰ ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • Android开发实现的计时器功能示例
    本文分享了Android开发实现的计时器功能示例,包括效果图、布局和按钮的使用。通过使用Chronometer控件,可以实现计时器功能。该示例适用于Android平台,供开发者参考。 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 十大经典排序算法动图演示+Python实现
    本文介绍了十大经典排序算法的原理、演示和Python实现。排序算法分为内部排序和外部排序,常见的内部排序算法有插入排序、希尔排序、选择排序、冒泡排序、归并排序、快速排序、堆排序、基数排序等。文章还解释了时间复杂度和稳定性的概念,并提供了相关的名词解释。 ... [详细]
  • Iwouldliketobeabletohaveasidebarthatcanbetoggledinandoutonabuttonpress.However ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • 本文介绍了如何使用iptables添加非对称的NAT规则段,以实现内网穿透和端口转发的功能。通过查阅相关文章,得出了解决方案,即当匹配的端口在映射端口的区间内时,可以成功进行端口转发。详细的操作步骤和命令示例也在文章中给出。 ... [详细]
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有