March 6

Upcoming Changes in jQuery 3

jQuery has been going strong and steady but is no longer as popular as it used to be. It’s still good for beginners to use but there are many alternatives nowadays. One major change in jQuery v2 was the removal of IE8 support and now we’re about to have version 3.0 Before 3.0, version 2.2 was released February 22, 2016 which had a big bug fix of the position() method which was causing a problem in Internet Explorer

At the time of this writing March, 2016, jQuery 3.0 is in Beta. Access the code now https://code.jquery.com/jquery-3.0.0-beta1.js or install via npm: npm install jquery@3.0.0-beta1

The performance has been improved of the show() and hide() methods by 100%, see benchmarks here http://jsperf.com/old-vs-new-show-hide/3

There was an issue with the data() method handling attributes with non-alpha characters. Something like this would fail
<div data-foo-42=”bar”></div>

The jquery.deferred object has been updated to be compatible with ES2015 Promises thus changing the then() method. An error callback turns in a rejection now.  Also callbacks are invoked asynchronously instead of on binding. The catch() is now an alias of then(null, func).

Precision has been added to width(), height(), css(‘width’), css(‘height’) so values can have decimal places since IE and Firefox tend to use them more.

These methods have been completely removed: load(), unload(), error()

jQuery animations have improved performance using requestAnimationFrame from the browser which are supported except in IE9 and Android 4.3.

jQuery custom selectors like :visible and :hidden are now up to 17 times faster! See the performance profiling https://github.com/jquery/jquery/issues/2042

Doesn’t seem like a lot but better web performance is always a good thing so even though the version is changing from 2.2 -> 3.0 the 3 indicates that as a new version, older usage of jQuery will break since some methods were removed. If thats the case for you, don’t forgot about adding jquery migrate to your code https://github.com/jquery/jquery-migrate/

 

Category: Code | Comments Off on Upcoming Changes in jQuery 3