Among key features in version 3.0 is an updating of
.data() implementation to more closely match the HTML5 dataset specification. "All keys are now converted from kebab-case to camelCase, regardless of access method, and digits no longer participate in the conversion," said jQuery Core team member Timmy Willison in a blog post. JQuery.Deferred objects, meanwhile, have been updated to be compatible with the Promises/A+ and ECMAScript 2015 promises. This required changes to the
Also, there have been "massive speedups" for some jQuery custom selectors. "Thanks to some detective work by Paul Irish at Google, we identified some cases where we could skip a bunch of extra work when custom selectors like
:visible are used many times in the same document. That particular case is up to 17 times faster now," said Willison.
Another change involves
.hide methods. Developers with jQuery 3.0 alpha had experimented with treating these methods like an
inline-display-none-remover (.show()) and
inline-display-none-adder (.hide()). "This had the advantage of simplifying these methods greatly and improving performance -- it required much fewer calculations. However, this proved to be problematic for our users," Willison said. "Removing
inline display:none did not always show the element (if the element was hidden from the stylesheet, for example), and that is far too common. We realized we couldn't provide a simple way for jQuery plug-ins, especially, to ensure that an element was shown." Thusly, jQuery developers have reverted that change; changes that have been kept for show and hide methods should have less impact on code, he said.
A jQuery Migrate 3.0 plug-in is planned, to help identify compatibility issues in code. Developers anticipate some breaking changes with the upgrade, and jQuery's builders dropped support for jQuery Compat to offer compatibility with more browsers but possibly at the expense of file size and performance. "On January 12, Microsoft dropped support for IE8, IE9, and IE10. We're not going to go that far just yet, but we are dropping support for IE8. And with IE8, so goes jQuery Compat, gone before we even released a final version. There will only be one jQuery from now on," Willison said.
This story, "jQuery turns 10 -- and hits 3.0 beta" was originally published by InfoWorld.