jQuery版本1,版本2和版本3有什么区别?[关闭]


114

我最近偶然发现了webchart.js使用jQuery版本2 的页面设计,而我使用的是jQuery版本1。

为了使代码正常工作,请使用现在的最新版本,然后检查了jQuery核心支持,并发布了jQuery 3。

我正在考虑现在使用版本3,但是我正在寻找版本3是否存在兼容性问题,因此只能在特定设备上使用。

Answers:


250

主要版本

1.0版:第一个稳定版本。
2.0版:性能改进和减少文件大小掉落IE 6-8支持
版本3.0:承诺/ A +为Deferreds支持,$.ajax并且$.when.data()HTML5兼容

所有版本

+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
| Version Number |    Release Date    |       Latest Update        | Size Prod (KB) |                                   Additional Notes                                    |
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
| 1.0            | August 26, 2006    |                            |                | First stable release                                                                  |
| 1.1            | January 14, 2007   |                            |                |                                                                                       |
| 1.2            | September 10, 2007 | 1.2.6                      | 54             |                                                                                       |
| 1.3            | January 14, 2009   | 1.3.2                      | 55.9           | Sizzle Selector Engine introduced into core                                           |
| 1.4            | January 14, 2010   | 1.4.4                      | 76             |                                                                                       |
| 1.5            | January 31, 2011   | 1.5.2                      | 83             | Deferred callback management, ajax module rewrite                                     |
| 1.6            | May 3, 2011        | 1.6.4                      | 89             | Significant performance improvements to the attr() and val() functions                |
| 1.7            | November 3, 2011   | 1.7.2 (March 21, 2012)     | 92             | New Event APIs: .on() and .off(), while the old APIs are still supported.             |
| 1.8            | August 9, 2012     | 1.8.3 (November 13, 2012)  | 91.4           | Sizzle Selector Engine rewritten, improved animations and $(html, props) flexibility. |
| 1.9            | January 15, 2013   | 1.9.1 (February 4, 2013)   | 90             | Removal of deprecated interfaces and code cleanup                                     |
| 1.10           | May 24, 2013       | 1.10.2 (July 3, 2013)      | 91             | Incorporated bug fixes and differences reported from both the 1.9 and 2.0 beta cycles |
| 1.11           | January 24, 2014   | 1.11.3 (April 28, 2015)    | 95.9           |                                                                                       |
| 1.12           | January 8, 2016    | 1.12.4 (May 20, 2016)      | 95             |                                                                                       |
| 2.0            | April 18, 2013     | 2.0.3 (July 3, 2013)       | 81.1           | Dropped IE 68 support for performance improvements and reduction in filesize         |
| 2.1            | January 24, 2014   | 2.1.4 (April 28, 2015)     | 82.4           |                                                                                       |
| 2.2            | January 8, 2016    | 2.2.4 (May 20, 2016)       | 85.6           |                                                                                       |
| 3.0            | June 9, 2016       | 3.0.0 (June 9, 2016)       | 86.3           | Promises/A+ support for Deferreds, $.ajax and $.when, .data() HTML5-compatible        |
| 3.1            | July 7, 2016       | 3.1.1 (September 23, 2016) | 86.3           | jQuery.readyException added, ready handler errors are now not silenced                |
| 3.2            | March 16, 2017     | 3.2.1 (March 20, 2017)     | 84.6           | Hotfixes for regressions that were introduced in the 3.2.0                            |
| 3.3            | January 19, 2018   | 3.3.1 (January 20, 2018)   | 84.8           | Deprecation of old function calls, functions that accept classes now support them     |
|                |                    |                            |                | defined in an array                                                                   |
| 3.4            | April 10, 2019     | 3.4.1 (May 1, 2019)        | 86.1           | Performance improvements, nonce and nomodule support, fixes for radio elements, a     |
|                |                    |                            |                | minor security fix                                                                    |
| 3.5            | April 10, 2020     | 3.5.1 (May 4, 2020)        | 87.4           | Security fixes, .even() & .odd() methods, jQuery.trim deprecated                      |
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+

参考:https : //en.wikipedia.org/wiki/JQuery#Release_history

主要版本的详细说明

1.0版是jQuery的第一个稳定版本。此版本支持旧的Web浏览器,它们各自的开发人员甚至不再支持。如果您期望使用旧版Web浏览器的访问者数量众多,那么绝对可以选择该版本。

版本2.0放弃了对Internet Explorer 6-8的支持,以提高jQuery的整体性能并减小库的文件大小。简而言之:2.0版在文件大小方面比1.0版更快,更小,但不再支持较旧的Web浏览器。由于Microsoft放弃了对Windows XP的支持,因此可以合理地假设您的访问者将使用与2.0版兼容的浏览器,除非您事先不知道这种情况(请参阅1.0版)。

随着版本3.0的发布,版本1.11.1和2.1.1都将升级到jQuery Compat 3.0和jQuery 3.0。jQuery Compat 3.0仍将支持较旧的浏览器,例如Internet Explorer 8,而常规版本3.0将仅支持常绿浏览器(特定浏览器的当前和先前版本)。

随着版本3.0的发布,没有理由坚持使用版本1.0或2.0。官方jQuery博客的几点说明:

  • 如果您需要对包括IE8,Opera 12,Safari 5等在内的各种浏览器的支持,请使用jQuery-Compat 3.0.0软件包。我们建议大多数网站使用此版本,因为它为所有网站访问者提供了最佳兼容性。
  • 如果您的网站仅针对常绿的前沿浏览器而构建,或者是Web视图中包含的基于HTML的应用程序(例如PhoneGap或Cordova)(您知道正在使用哪些浏览器引擎),请使用jQuery 3.0.0程序包。
  • 在我们另行声明之前,两个软件包都将包含相同编号的主要和次要版本的相同公共API。这应该使开发人员可以轻松地在两者之间进行切换,并且最大程度地与第三方jQuery插件兼容。

参考:https : //blog.jquery.com/2014/10/29/jquery-3-0-the-next-generations/


6
ASP.NET 4.0用户注意事项:jQuery 3.x中断回发。 jquery.com/upgrade-guide/3.0/...
贾里德瑟斯克

2
这个答案真的正确吗?据我了解,jQuery Compat 3.0甚至没有超过alpha版本。
HischT

2
@HischT参考提供了答案。您正在谈论的部分甚至是从jQuery自己的博客文章中随意复制的。我不知道您希望它有多精确,但是我可以保证它不会比参考源更好。另外,请查看此答案的日期。那是两年多以前了。我会尽力使此更新与有关新版本的相关信息,但是仅此而已。如果您认为可以改进,请编辑答案,并由我或社区进行审查。
icecub

2
@icecub请注意,我的评论仅是一个问题,而不是真实的事实,因为我不确定100%。我只是尝试下载甚至找到有关jQuery Compat 3的任何信息,但找不到比您所指的博客文章及其其他Alpha版本更多的信息。对我来说,他们似乎在发布前就放弃了jQuery Compat 3。如果有人能证明我错了,我将非常高兴,因为我很想在项目中使用jQuery Compat 3。
HischT

6
MS放弃了对IE8-10的支持后,Jquery-compat在2016年初发布之前被取消。blog.jquery.com/2016/01/14/jquery-3-0-beta-released
Dan被Firelight摆弄了Firelight
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.