2017-01-12 118 views
45

我最近在一個webchart.js頁面設計使用jQuery版本2迷迷糊糊的,我使用jQuery版本1.jquery版本1,版本2和版本3版本有什麼區別?

對於工作代碼看到它現在使用最新版本,那麼我檢查jQuery的核心支持,他們有jQuery 3發佈。

我正在考慮現在使用版本3,但是我正在尋找版本3是否存在兼容性問題,以致它只能在特定設備上使用。

+0

我投票關閉這一點,因爲目前還不清楚你問什麼。三個jQuery版本之間的區別太廣泛了,您是否應該爲圖書館切換版本並不是討論的問題。您應該使用webchart.js開發人員建議的版本。 – jmargolisvt

+4

@jmargolisvt我不同意。我的答案几乎涵蓋了它:) – icecub

+2

對。我不認爲這個問題顯示出很多研究,它不清楚它與圖書館有什麼關係,但我喜歡你的答案。 :) – jmargolisvt

回答

105

主要版本

1.0版本:第一個穩定版本。
2.0版本:掉落IE 6-8的性能改進和減少文件大小
3.0版的支持:用於Deferreds,$.ajax$.whenPromises/A+支持.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                 | 
+----------------+--------------------+----------------------------+----------------+---------------------------------------------------------------------------------------+ 

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

D etailed主要版本的解釋

版本1.0是jQuery的第一個穩定版本。此版本支持較早的Web瀏覽器,它們甚至不再受各自開發人員的支持。如果你期望有大量的瀏覽器訪問較老的瀏覽器,這肯定會成爲這個版本。

版本2.0放棄了對Internet Explorer 6-8的支持,以增加jQuery的整體性能並減少庫的文件大小。簡而言之:版本2.0在文件大小上比版本1.0更快更小,但不再支持舊版的Web瀏覽器。由於微軟放棄了對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, 歌劇12,Safari 5的等支持,使用jQuery的COMPAT 3.0.0包。 我們爲大多數網站推薦此版本,因爲它爲所有網站訪問者提供了最佳兼容性 。
  • 如果你的網站是唯一的常綠領先的瀏覽器內置,或 是包含在網頁視圖(例如PhoneGap的或 科爾多瓦),您知道哪些瀏覽器引擎都在使用基於HTML的應用程序,去jQuery 3.0.0包的 。
  • 在我們另行通知之前,兩個軟件包將包含相同編號的主版本和次版本的相同 公共API。這個 應該可以讓開發人員很容易在兩者之間切換,並且最大程度地兼容第三方jQuery插件。

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

+0

感謝這一點。 – zero8

+5

@ zero8不客氣:)如果我的回答提供了您需要的信息,請點擊問題左側的綠色複選標記以接受它。這將確保你的問題不會永遠得不到解答,並且是向幫助你的人表示感謝。 – icecub

相關問題