|jQuery 3.0 In Alpha|
|Written by Kay Ewbank|
|Thursday, 16 July 2015|
The JQuery team has announced alpha versions of both variants of jQuery – and both are version 3.0.
If you are wondering why there appears to be a big gap from the versions you are currently working with to the forthcoming release the answer is provided in Query Adopts Semantic Versioning which explains how from this version incompatible changes would be signalled by incrementing the major version number.
While there are some ‘breaking changes’ in jQuery 3 the developers:
“anticipate that these releases shouldn’t be too much trouble when it comes to upgrading existing code”
and also say they hope they don’t actually affect that many people. You can check out the likelihood of problems using the jQuery Migrate plugin.
The two strands of jQuery will in future share the same number with the "Compat" branch supporting as many browsers as possible, i.e. it will feature wide compatibility, whereas the standard jQuery will work with the current and previous versions of the browsers that are common at the time of its release.
For this release, jQuery 3.0, supports browsers and environments from IE9 forward; while jQuery Compat 3.0 includes support for IE8. Both versions will include support for the freeware browser Yandex.Browser.
The major breaking changes are to do with the .show() and .hide() methods. The developers have changed the methods to revert to a simple model that will break some code, but which gets over a historical mess.
The reason the change is needed is that while the basic .hide() and .show() methods alter the display of elements in CSS, over time these methods had been extended to deal with special cases. This led to the need for jQuery handlers that listen for the orientationchange or resize events and manually hide or show parts of the page; it defeats the elegant solution that media queries were trying to implement.
As the blog post says:
“jQuery was already about halfway down the path to total madness, and it didn’t make sense to complete the journey. The special cases and checks were not only complex and incomplete, but they caused significant performance issues on large pages.”
The solution has been a major simplification of the model.
Another main change is the addition of full support for ECMAScript 6's Promises/A+ specification. jQuery.Deferred objects have been updated and verified for compliance. The need for compliance has resulted in the introduction of a .catch() method and some major changes to the .then() method. Specifically, if a .then() callback throws an exception, it becomes a rejection value. Previously, exceptions bubbled all the way up, aborting callback execution and irreversibly locking both the parent and child Deferred objects.
Support has also been improved for the new HTML5 dataset specification. This is now properly supported through .data(), meaning you get access to all the data-* attributes nested inside an HTML element. All keys are now converted from kebab-case to camelCase, regardless of access method, and digits no longer participate in the conversion.
One more specialist change that could result in much faster performance comes via speedups for some jQuery custom selectors. The developers have identified some cases where it is possible to skip some work when custom selectors like :visible are used many times in the same document. One particular case is up to 17 times faster.
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 16 July 2015 )|