Javascript jQuery版本1、版本2和版本3之间有什么区别?
我最近偶然发现了一个使用jQuery版本2的页面Javascript jQuery版本1、版本2和版本3之间有什么区别?,javascript,jquery,Javascript,Jquery,我最近偶然发现了一个使用jQuery版本2的页面webchart.js设计,我现在使用的是jQuery版本1 为了让代码正常工作,请确保现在使用最新版本,然后我检查了jQuery核心支持,他们发布了jQuery3 我现在正在考虑使用版本3,但我正在寻找版本3是否存在兼容性问题,即它是否只能在特定设备上使用。主要版本 +----------------+--------------------+----------------------------+----------------+------
webchart.js
设计,我现在使用的是jQuery版本1
为了让代码正常工作,请确保现在使用最新版本,然后我检查了jQuery核心支持,他们发布了jQuery3
我现在正在考虑使用版本3,但我正在寻找版本3是否存在兼容性问题,即它是否只能在特定设备上使用。主要版本
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
| 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 6–8 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 |
| 3.6 | March 2, 2021 | 3.6.0 (March 2, 2021) | 90.0 | Bug fixes, return JSON when there is a JSONP error |
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
1.0版:第一个稳定版本。版本2.0:放弃了IE 6–8对性能改进和文件大小缩减的支持
版本3.0:支持延迟,
$.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 6–8 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 |
| 3.6 | March 2, 2021 | 3.6.0 (March 2, 2021) | 90.0 | Bug fixes, return JSON when there is a JSONP error |
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
参考:
主要版本的详细说明
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
| 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 6–8 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 |
| 3.6 | March 2, 2021 | 3.6.0 (March 2, 2021) | 90.0 | Bug fixes, return JSON when there is a JSONP error |
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+
1.0版是jQuery的第一个稳定版本。此版本支持较旧的web浏览器,这些浏览器甚至不再受各自开发人员的支持。如果您希望有大量的访问者使用较旧的web浏览器,那么这肯定是您想要的版本
版本2.0放弃了对InternetExplorer6-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将仅支持evergreen浏览器(特定浏览器的当前和以前版本)
随着版本3.0的发布,没有理由坚持使用版本1.0或2.0。来自jQuery官方博客的一些注释:
- 如果您需要支持包括IE8在内的各种浏览器, Opera 12、Safari 5等都使用jQuery Compat 3.0.0包。 我们建议大多数网站使用此版本,因为它提供 为所有网站访问者提供最佳兼容性
- 如果您的网站仅为主流浏览器构建,或 webview中是否包含基于HTML的应用程序(例如PhoneGap或 Cordova)如果您知道正在使用哪些浏览器引擎,请选择 jquery3.0.0包
- 除非我们另行声明,否则两个包将包含相同的内容 相应编号的主要和次要版本中的公共API。这 应该使开发人员能够轻松地在两者之间切换,并且 最大限度地与第三方jQuery插件兼容。
参考:ASP.NET 4.0用户注意:jQuery 3.x中断回发。这个答案真的准确吗?据我所知,jQuery Compat 3.0的版本甚至不超过alpha版本。@HischT引用随答案一起提供。你所说的部分甚至是从jQuery自己的博客文章中抄袭过来的。我不知道你希望它有多准确,但我可以保证它不会比有来源作为参考更好。另外,看看这个答案的日期。那是两年多以前的事了。我尽我最大的努力让这篇文章与新发布的相关信息保持更新,但基本上就是这样。如果您觉得可以改进,请编辑答案,并让我或社区对其进行审查。@icecub请注意,我的评论是作为一个问题而不是一个真实的事实,因为我不是100%确定。我只是试着下载甚至找到了关于jQueryCompat3的任何信息,但除了你提到的那篇博文和它的另一个alpha版本之外,我找不到更多的信息。在我看来,他们似乎在发布前抛弃了jQuery Compat 3。如果有人能证明我错了,我会非常高兴,因为我很想在我的项目中使用jQuery Compat 3。在微软放弃对IE8-10的支持后,jQuery-Compat在2016年初发布之前被取消。