什么时候可以使用jQuery? [英] When is it acceptable to use jQuery?

查看:175
本文介绍了什么时候可以使用jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在思考在哪里划定界限,我想从那里经验丰富的开发人员那里得到一些答案.什么时候可以在Web应用程序中引用jQuery?

I have recently been thinking alot about where to draw the line, and I wanted to get some answers from you experienced developers out there. When is it acceptable to reference jQuery in a web app?

始终使用jQuery 的一些支持参数:

  • 您可以从Google的存储库中引用jQuery,因为它可能已经在客户端上缓存了,从而消除了额外的繁琐请求
  • 您不必处理常见的跨浏览器问题,因为这些问题已经得到解决
  • 您喜欢编写代码,因为它对开发人员友好

从不使用jQuery 的一些支持参数:

  • 第三方库令人不安的依赖关系,其中可能包含昂贵的错误,并可能导致不合理的性能下降
  • 您必须学习一种新的语法(就在您以为自己想出了常规Javascript的时候……)
  • 由于框架固有的复杂性,即使是最简单的任务也可能执行得不好

我将论点列为问题的一部分,因为我不希望得到权衡双方论点的答案.我希望总是/从不回答,最好是在测试用例场景中(模糊的详细).

I listed arguments as part of the question because I do not wish to have answers weighing the arguments of both sides. I am hoping for always/never answers, preferrably with test case scenarios (vague or detailed).

例如:如果我需要在Web应用程序中执行任何AJAX请求,我将始终使用jQuery".

For example: "If I ever need to do any AJAX requests in my web app, I always use jQuery".

推荐答案

如果我在Web应用程序中除了document.getElementById()之外还需要做任何事情,我将始终使用jQuery.

If I ever need to do anything past document.getElementById() in my web app, I always use jQuery.

老实说,我发现您对jQuery的大多数争论都很弱,尤其是最后一个:

I honestly find most of your con arguments against jQuery pretty weak, particularly the last one:

由于框架固有的复杂性,即使是最简单的任务也可能执行得很差.

Even the simplest of tasks can perform poorly, because of the inherent complexity of the framework.

完全不同意. jQuery非常简单,但功能强大,这就是我喜欢的.

Do not agree with that at all. jQuery is incredibly simple while powerful and that's what I love about it.

这篇关于什么时候可以使用jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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