What's Upcoming in jQuery 1.8, 1.9 and 2.0, and the Removal of IE6/7/8 Support
The jQuery Core team has recently released jQuery 1.8 Beta 1. The code is available from the jQuery CDN at http://code.jquery.com/jquery-1.8b1.js. The GA release is expected July 2012. The jQuery Core team has also laid out their plans for the next versions of jQuery, versions 1.9 and 2.0, and talks about the removal of IE6/7/8 support.
Here are the most notable changes for version 1.8.
jQuery 1.8 has a new build system based on grunt that allows you to easily build custom versions of jQuery. You can now exclude unused modules to make jQuery as small as possible. To build your own custom version, clone the jQuery repo and use grunt to exclude modules. The optional modules are ajax, css, dimensions, effects, and offset. For example, to remove all optional modules, the series of commands will look something like this:
git clone git://github.com/jquery/jquery.git cd jquery && npm install grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-offset
This will give you a custom jQuery that's about 21KB (minified and gzipped). Note that this functionality is for advanced users as you must understand your project dependencies especially that of third party plug-ins you use. Complete instructions can be found in the jQuery README file.
Automatic Vendor CSS Prefixing
$.css() automatically takes the non-prefixed property name and generates the prefix that is appropriate for the current browser. Web developers no longer need to worry about all the vendor specific property names. In Chrome for example, the jQuery call $("#myscroll").css("marquee-direction", "backwards") will set the CSS to -webkit-marquee-direction: backwards.
The jQuery animation code has been cleaned up and enhanced with several extension points that make it easier to add or modify animations. If you need to support older browsers without built-in animations, the new $.Animation provides a solid foundation. If you only need to support modern browsers and use their natively supported animations, you can skip the animation module entirely. Note documentation on $.Animation is work in progress.
Sizzle Selector Engine Update
Sizzle, jQuery's CSS selector engine, has undergone a major rewrite in 1.8. This has brought performance improvements on selector matching, as well as improved shortcuts for the most common selectors.
jQuery 1.8 introduces the new method $.parseHTML, which lets you specify input as HTML and know that they will be parsed as HTML. This is something that $() cannot do since it also interprets input strings as selectors. $.parseHTML also provides a way to parse HTML into a DOM fragment and control the execution of scripts. It's strongly recommend to use $.parseHTML, especially for cases where input is taken from untrustworthy sources such as the URL or user input. jQuery 1.9 will have more changes for better XSS protection which will be discussed further below.
Attachment of Global Ajax Events
Global ajax events, such as ajaxStart fired by $.ajax, can currently be attached to any element - even to elements that are not in a document. This creates an inefficient special case, so this behavior will be deprecated in jQuery 1.8.
Here is what's planned for version 1.9, which is expected to be released in early 2013.
By design, the $() method can create HTML elements and run scripts if passed the <script> tag. Developers have sometimes forgotten this, passing strings to jQuery that come from untrustworthy sources which can lead to cross-site-scripting (XSS) attacks. In jQuery 1.9, the "looks like HTML" rule for the $() method is being tightened down. A string will only be considered HTML if the first character is a less-than sign, otherwise it will be assumed to be a CSS selector. Since some HTML strings will no longer be recognized by $() as a result of these stricter rules, be sure to check your code if you use this functionality, and possibly use $.parseHTML as a replacement function.
$.browser, $.sub Removal
$.browser has been deprecated since jQuery 1.3 and will be removed in jQuery 1.9. Developers who are still using $.browser should look at $.support or Modernizr for feature detection. Other options include using the jQuery 1.9 compatibility plug-in, or reading the navigator.userAgent string directly.
$.sub has been deprecated since jQuery 1.7 and will be removed in jQuery 1.9. This function creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object. This hasn't proved to be useful and will be moved to the 1.9 compatibility plug-in. Expect the file size of jQuery 1.9 to be smaller with the removal of deprecated items.
Here is what's planned for version 2.0, which is expected to be released in early 2013, not long after the jQuery 1.9 release.
Removal of IE6/IE7/IE8 Support
jQuery 2.0 will support the same APIs as jQuery 1.9 does. It has no major feature additions, but removes support for IE 6/7/8 oddities such as borked event model, IE7 "attroperties", HTML5 shims, etc. The goal is for 1.9 and 2.0 to be interchangeable as far as the API set they support. jQuery 2.0 will be smaller, faster, and will lack the problems introduced by the need for IE6/7/8 support. If you need IE 6/7/8 support, choose 1.9; otherwise you can use 1.9 or 2.0. You can also use conditional comments to include 1.9 only when using IE6/7/8.
<!--[if lt IE 9]> <script src="jquery-1.9.0.js"> <![endif]--> <!--[if gte IE 9]><!--> <script src="jquery-2.0.0.js">< <!--
The jQuery team will continue to support and maintain version 1.9 even after jQuery 2.0 is released, as long as IE6/7/8 is a significant factor on the web. The jQuery team doesn't anticipate adding a lot of new APIs in the future and new functionality will be added through plug-ins compatible with both 1.9 and 2.0.
Anatole Tresch Mar 03, 2015