jQuery 3.0: future generations
Incredible, but true: almost eight years have passed since the release of JQuery. Web development has changed a lot over the years, and jQuery has changed with it. And all this time, our team tried to maintain a perfect balance between compatibility with outdated code and support for the most modern methods of web development.
One of the best ways to do this is through semver versioning . In practical terms, for developers and development tools, SemVer gives an idea of the risks associated with the transition to a new version of the software. Version numbers are in the format MAJOR.MINOR.PATCH, where each of the three components is an integer. According to SemVer, if the MAJOR number changes, this indicates significant API changes that developers need to be very careful about.
This versioning concept is nuanced when it comes to jQuery, because browser compatibility can be as important as API compatibility. In an attempt to create a more elegant jQuery, the team released two versions in 2013. The first remained in the line 1. * (today it is 1.11.1) and provides compatibility with the maximum number of browsers. The second version, starting from 2.0.0 until today 2.1.1, excludes support for a number of browsers such as IE8 and lower in order to optimize the code. Both 1. * and 2. * versions of jQuery have the same public API, although there are some differences in their internal implementation.
Our future releases will use a different nomenclature. As before, we are talking about two different packages. The successor to today's version 1.11.1 will be jQuery Compat 3.0. The successor to jQuery 2.1.1 will be jQuery 3.0. We are talking about two different packages on npm and Bower, but they will have the same version to indicate the fact that their APIs are the same.
We are also reviewing our browser support policies starting with these releases. The main jQuery package remains compact and rigorous, thanks to the support of only new browsers (current and previous versions of each), common at the time of release. Perhaps we will include support for additional browsers based on market shares. The jQuery Compat package offers more browser support, but at the expense of larger size and potentially lower performance.
Despite the big difference in version numbering, we do not expect serious problems when migrating from most existing jQuery variants. We just want to comply with all SemVer versioning rules. Changes like removing obsolete methods will be determined by the new version of the jQuery Migrate plugin- to facilitate their search and correction. We’ll tell you a little more details about the changes in the next blog posts.
So, briefly about the main version 3.0 of the jQuery API for those who do not want to read a lot of letters:
- If you need support for the maximum number of browsers, including IE8, Opera 12, Safari 5 and the like, use the jQuery Compat 3.0 package. We recommend this version for most newly created sites, as it provides better compatibility for all visitors without exception.
- If your site is created only for new and popular browsers, or you are developing an HTML application for WebView (like PhoneGap or Cordova) when you know which browser engines you will use, the jQuery 3.0.0 package is better.
- Until we report the opposite, both packages contain the same public API in their respective major and minor versions. This should make it easier for developers to switch between them and improve compatibility with third-party jQuery plugins.
As work progresses on version 3.0, we will talk about the details of code changes, browser support, and the like. Stay in touch!