New Year's Day, the JQuery team released two newer versions yesterday: 1.12 and 2.2. These two versions contain a number of bug fixes and feature improvements. Basically this will be the last release before 3.0. However, since 3.0 is not backwards compatible, the JQuery team will continue to maintain these two versions, certainly only bug fixes. The news about 3.0 will be announced shortly.
So what has changed in the new version?
Performance improvements
This version shortens the reference path for Sizzle, which querySelectorAll
matchesSelector
can lead to performance gains when native and unusable. The effect is obvious in the production environment.
New features
Small upgrade a lot, here only to say the important.
Class operations for SVG
As an HTML library, it is a legitimate support for SVG elements. The new version of this can be used, and, the .addClass()
.removeClass()
.toggleClass()
.hasClass()
operation of SVG objects class
. It is important to note, however, that there are many differences between SVG and HTML, so it is better to choose a more specialized class library If you really want to do complex operations.
Jquery.post and Jquery.get Support object parameters
Title:
jQuery.post({ url: “/example”});
The benefits are much more, such as setting a callback function context
or cross-domain post withCredential: true
.
New operator Support
Support for new operators introduced by ES6/ES2015, JQuery objects can be for-of
traversed.
for (element of $elements) { console.log(element);}
jQuery.htmlPrefilter()
HTML5 does not require tags to be closed, but XML is required. This function is used for conversion. In this way .html()
, .append()
we .replaceWith()
do not need to convert manually when we use it. In turn, we don't need to be so strict with the validation input.
jQuery.uniqueSort()
jQuery.unique()
Naming a bit of a problem, failed to reflect the sort, so this time renamed jQuery.uniqueSort()
. jQuery.unique()
remain, but only the latter will be recorded in the document.
This function focuses on the sorting and discharging of the DOM nodes, so do not use them indiscriminately.
Summarize
This version is theoretically not much changed and can be upgraded smoothly. But if there is any problem with the black face, please report it to the official.
New versions of JQuery 2.2 and 1.12 released