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

MooTools和JQuery并排-MooToolsandJQuerySidebySide

IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef

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?

我刚刚继承了一些使用MooTools的网页。我从未使用过MooTools。现在我需要在页面上添加一些函数,我想知道在同一页面上使用jquery和mooTools是个好主意吗?

Basically, I have 3 options,

基本上,我有3个选项,

  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 个解决方案

#1


46  

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,然后继续学习。听起来像学习新事物的好机会。如果你不需要,为什么要引入一个带有附加js膨胀的全新库。如果它能解决问题你就是金色的。

#2


16  

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.

MooTools是一个完全可靠且可接受的Javascript库,我建议您将其添加到已知技术列表中,而不是将其删除并替换为JQuery。混合这两者并不是一个好主意,因为您可能会遇到模糊的难以调试的冲突。

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当然。

#3


7  

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

就个人而言,我建议不要同时使用两者,因为即使使用jQuery.noConflict()也存在奇怪的冲突。一个或另一个去。

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

如果你最终使用两者,请务必使用jQuery.noConflict()以确保使用$不会发生冲突。

Using jQuery with Other Libraries

将jQuery与其他库一起使用

#4


7  

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).

无论你决定什么,使用两个框架是不好的做法(当你没有框架时)。

#5


6  

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...

这取决于转换为jQuery的项目有多大,维护这些页面的工作量(与已经使用jQuery的其他页面相比),第一组更改的紧迫性等等......

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).

它归结为成本比较:您将业务转换为jQuery的成本与您学习mooTools的业务成本相比如何(并且可能同时保持mootools和jquery)。

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.

我唯一可以肯定的是不做选项3.这不一定是因为你不能使它工作(并且会有挑战),但是因为你必须学习mootools来正确维护无论如何这些页面。一旦你这样做,你可能只是让他们保持mootools而不是重写所有内容或尝试混合框架。

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,因为我相信jQuery最终会在市场上占据一席之地。这意味着它将在某个时刻转换为jQuery,因此业务的长期成本可能最好通过更早地进行转换来优化,而转换的时间更少,并且mootools仍然相关,因此您可以轻松获得转换的帮助。但这肯定是有争议的。

#6


4  

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

jQuery和Mootools的基础知识非常接近,从一个移动到另一个并不是一个令人头痛的问题。

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.

像其他人建议的那样,你可以借此机会作为学习经历。如果您对jQuery感到满意并且不觉得需要学习另一个框架,请将代码移植到底。最后你不会真的出错。

#7


3  

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.

既然你对jQuery更熟悉,我只需要调用jQuery.noConflict();第一件事,并在jQuery中编写函数。当然,如果时间是一个因素。

#8


2  

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...)

有一个项目扭曲并刺激Mootools使它看起来像JQuery(穿着羊皮的狼......或者看起来像银色的金币......)

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

我当然认为你应该学习Mootools,但这可能有所帮助。

#9


1  

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.

我赞同那些赞成学习mootols的人,但我认为如果你做出这个决定会更好,因为你最终认为学习mootools值得。

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

所以我认为对mootools功能进行一些研究会很好。

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

我喜欢这个关于这个主题的关键词。我认为这对阅读这个帖子的人来说很有用。

http://jqueryvsmootools.com/index.html

#10


0  

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

我在SharePoint网站上运行它没有任何问题。克里斯


推荐阅读
  • 本文讨论了如何使用Web.Config进行自定义配置节的配置转换。作者提到,他将msbuild设置为详细模式,但转换却忽略了带有替换转换的自定义部分的存在。 ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 纠正网上的错误:自定义一个类叫java.lang.System/String的方法
    本文纠正了网上关于自定义一个类叫java.lang.System/String的错误答案,并详细解释了为什么这种方法是错误的。作者指出,虽然双亲委托机制确实可以阻止自定义的System类被加载,但通过自定义一个特殊的类加载器,可以绕过双亲委托机制,达到自定义System类的目的。作者呼吁读者对网上的内容持怀疑态度,并带着问题来阅读文章。 ... [详细]
  • 本文介绍了使用readlink命令获取文件的完整路径的简单方法,并提供了一个示例命令来打印文件的完整路径。共有28种解决方案可供选择。 ... [详细]
  • 本文整理了Java中org.apache.solr.common.SolrDocument.setField()方法的一些代码示例,展示了SolrDocum ... [详细]
  • Commit1ced2a7433ea8937a1b260ea65d708f32ca7c95eintroduceda+Clonetraitboundtom ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
author-avatar
mobiledu2502882453
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有