First jQuery 3.x version comes with support for the requestAnimationFrame API and the Promises/A+ specification

Jul 14, 2015 08:21 GMT  ·  By

The jQuery team has released the first version of their upcoming 3.x major branch which, compared to 2.x, does not feature as many breaking changes.

jQuery, even if not as popular on Twitter as it once used to be, is not going away any time sooner in favor of AngularJS, and to our surprise its usage among developers has also considerably grown since the last time we checked.

It was about a year ago when we examined the Builtwith.com statistics service and  noticed jQuery had been used on around ~55% of all the Top Million sites on the Internet, and ~70% for the Top 10K sites. Now jQuery is at 64% for the Top Million sites (9% growth), and slightly down to 66% for Top 10K sites. As you can tell for yourself, the library seems to be doing just fine.

Now, the jQuery dev team announced jQuery 3.0 Alpha, which can be used with all modern browsers (IE9 and up), and jQuery Compat 3.0 Alpha, a special version which will also work with IE8.

So what's new?

First off, the team announced they would be supporting the Yandex Browser from now on, but there are more interesting changes included as well.

One of them is full support for ECMAScript 6's Promises/A+ specification, which is now supported through jQuery.Deferred and by the addition of a new .catch() method.

The new HTML5 dataset specification is now also properly supported via .data(), allowing easy access to all the data-* attributes nested inside an HTML element. This wasn't a major overhaul, but only a few tweaks to make sure jQuery's code is compliant with the official specification.

Changes to the .show() and .hide() methods were also included to help them work with responsive websites. The methods are now much simpler in their make-up, but they're also going to be the main culprits if your code breaks when upgrading to the 3.x branch.

More performant animations via the requestAnimationFrame API

If, by any chance, you're still using jQuery to perform animations and are not using more dedicated tools like Velocity.js, then you'll be happy to know jQuery's animations now work via the requestAnimationFrame API.

The team noted, "We think we’ve beaten most of [...] issues by suspending animations while a browser tab is out of view." This change "should result in animations that are smoother and use less CPU time – and save battery as well on mobile devices."

Lots more miscellaneous features and bug fixes are also included, along with massive speedups for some jQuery custom selectors that will improve overall interoperability.

If you want to test jQuery 3.0 Alpha, you can use the jQuery Migrate plugin and identify compatibility issues with your code, before going on and planning to update your code to run on the upcoming version.