jQuery 3.6.1 has been released! It’s been a while since our previous release. We were looking at fixing some elusive edge cases related to focus and blur, but we never quite got the fix right. If there’s any area of jQuery that’s hard to change, it’s likely related to focus somehow. We’re leaving those as-is for now and will address them in the future, especially since the changes may end up warranting a major version release. See gh-4856 and gh-4950 for more details.
That said, this release still comes with some important fixes, detailed below.
As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.1:
Infrastructure Improvements
We’ve done a lot of work in this release to update some of our testing and build infrastructure, including migrating CI from Travis CI to GitHub Actions, testing on Node 16 instead of Node 15, loading our testing listener over https, and adding more accurate testing for custom builds. We also removed some old links from comments in some files in the repo. These links were to URLs that have since been compromised. While these files were never distributed in a release, they still existed in the GitHub source and have been removed.
Not losing focus
There’s still one fix related to focus in this release. Our special event handling for focus remained attached even after jQuery focus handlers were removed, which broke any subsequent manual focus triggers. For example,
$elem.on("focus", function() {}).off("focus").trigger("focus");
would not trigger focus.
Skipping falsey in addClass( array )
Without any size increase, we added support for skipping over any falsey values in an array passed to addClass
or removeClass
.
This makes code like:
elem.addClass( [ "a", "", "b" ] );
add both the a
& b
classes.
Aligning with the spec for custom CSS property values
A change to the CSS spec requires that custom properties be trimmed. Whitespace is now trimmed for custom CSS property values. Before, something like --prop: value ;
would retain the leading and trailing spaces in the value, returning ” value “.
Appending scripts with HTML comments
An issue was discovered with our regex that strips HTML comments from scripts when they are appended, which ended up removing parts of the executable script in certain edge cases. Fortunately, our fix was to rely more on the browsers, but we still need to strip CDATA sections for IE in the 3.x branch. That will be removed in 4.0.
A performance boost for jQuery.trim
While jQuery.trim
has already been removed on the main branch in favor of native String#trim
in preparation for the next major release, it’s still needed on the 3.x branch for some browsers that branch supports, such as Android 4.0. There were certain edge cases that were incredibly slow due to the structure of our regex. That has since been changed and the speed-up is significant.
Upgrading
We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.
The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.
If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.
Download
You can get the files from the jQuery CDN, or link to them directly:
https://code.jquery.com/jquery-3.6.1.js
https://code.jquery.com/jquery-3.6.1.min.js
You can also get this release from npm:
npm install jquery@3.6.1
Slim build
Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:
https://code.jquery.com/jquery-3.6.1.slim.js
https://code.jquery.com/jquery-3.6.1.slim.min.js
These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.
Thanks
Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including fecore1, Richard Gibson, Simon Legner, Michal Golebiowski-Owczarek, Vladimir Sitnikov, Timo Tijhof, Christian Oliff, ygj6, and the whole jQuery team.