DEV Community

Cover image for jQuery 3.7.0 - What's new ?
Kristiyan Velkov
Kristiyan Velkov

Posted on

jQuery 3.7.0 - What's new ?

jQuery 3.7.0 is now available!

New method: .uniqueSort()

Some APIs, like .prevAll(), return elements in reverse order, which can result in some confusing behavior when used with wrapping methods.

Enter fullscreen mode Exit fullscreen mode

Added some unitless CSS properties
jQuery 3.7.0 adds support for more CSS properties that should not automatically have “px” added to them when they are set without units. For instance, .css('aspect-ratio', 5) would result in the CSS aspect-ratio: 5px;. All in all, we added seven more properties, and we got a little help with our list from React. Thanks, React!

Performance improvement in manipulation
jQuery 3.7.0 comes with a measurable performance improvement for some use cases when using manipulation methods like .append(). When we removed a support test for a browser we no longer support, it meant that checks against document changes no longer needed to run at all. Essentially, that resulted in a speedup anywhere between 0% and 100%. The most significant speedup will be for some rare cases where users frequently switch contexts between different documents, perhaps by running manipulations across multiple iframes.

Negative margins in outerHeight(true)
Back in jQuery 3.3.0, we fixed an issue to include scroll gutters in the calculations for .innerWidth() and .innerHeight(). However, that fix didn’t take negative margins into account, which meant that .outerWidth(true) and .outerHeight(true) no longer respected negative margins. We’ve fixed that in 3.7.0 by separating the margin calculations from the scroll gutter adjustments.

Using different native focus events in IE
Focus and blur events are probably the most complicated events jQuery has to deal with across browsers. jQuery 3.4.0 introduced some minor regressions when it fixed an issue with the data passed through focus events. We were finally able to close all of those tickets in jQuery 3.7.0!

But, we need to point out a possible breaking change in IE. In all versions of IE, focus & blur events are fired asynchronously. In all other browsers, those events are fired synchronously. The asynchronous behavior in IE caused issues. The fix was to change which events we used natively. Fortunately, focusin & focusout are run synchronously in IE, and so we now simulate focus via focusin and blur via focusout in IE. That one change allowed us to rely on synchronous focus events in IE, which solved a lot of issues (see the changelog for the full list).

Image description


Image description

If you like my work and want to support me to work hard, please donate via:

Revolut website payment or use the QR code above.

Thanks a bunch for supporting me! It means a LOT 😍

Top comments (0)