原型VS jQuery-优点和缺点? [英] Prototype VS jQuery - Strengths and Weaknesses?

查看:94
本文介绍了原型VS jQuery-优点和缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想打开另一个"另一个Js VS Js "线程.

I don't want to open another "Yet Another Js VS Js" thread.

我猜想,最终Prototype和jQuery都是JS,并且具有几乎相同的方法和功能,并且对于相同的任务需要几乎相同的代码行.

I guess, in the end Prototype and jQuery are both JS and have almost the same methods and functions and need almost the same lines of code for identical tasks.

对于一个真正的 Rich Internet Application ,什么是真正的优势?什么是Prototype vs. jQuery中的弱点?

For a real Rich Internet Application, what are the real strengths and what the weaknesses in Prototype vs. jQuery?

推荐答案

最初,我喜欢使用新方法或经过修改的方法来扩展原型元素的想法.

I initially liked the idea of Prototype's extending elements with new or modified methods.

但是,我发现了很多原因,这是一件坏事(TM)

However, I've discovered a number of reasons this is a bad thing (TM)

进行一些谷歌搜索,您可能会发现一些其他原因,但是主要的原因是不能保证Prototype与其他框架或库玩得开心",因为其他库期望元素和方法的行为是标准",由于原型的作用,您可能会发现许多被原型破坏的东西.

Do some googling and you'll probably find some other reasons, but the primary reason is that Prototype cannot be guaranteed to "play nice" with other frameworks or libraries, as other libraries expect the behaviour of elements and methods to be "standard", and due to the things Prototype does, you may find a number of things that are broken by it.

我发现的最新示例是Prototype与JSON和stringify拧紧.我使用的是EasyXDM,在某些情况下,仅在加载了prototype.js库的情况下,它才无法正常工作.当我正在编写供其他人使用的框架时,因此无法控制页面的内容,因此我需要在IFRAME中创建并执行所有操作,以确保诸如原型之类的内容.js并未破坏我的尝试.

The most recent example I discovered was Prototype screwing with JSON and stringify. I was using EasyXDM, and it simply did not work in some cases where the prototype.js library was loaded. As I was writing a framework to be used by others, and thus did not have control over the content of the page, I needed to create and do everything in an IFRAME in order to ensure things such as prototype.js did not play havoc with what I was trying to do.

...因此jQuery对我而言是成功之举,因为我只是认为框架自动适应DOM和javascript的标准行为不正确.您应该控制这些事情,Prototype使您摆脱了某些控制....

...so jQuery wins hands-down for me, because I just don't think its right for a framework to automatically screw with the standard behaviour of the DOM and javascript. YOU should be in control of these things, Prototype takes some of this control away from you....

这篇关于原型VS jQuery-优点和缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆