jQuery 3.7.0 Released: Staying in Order

Posted on by

jQuery 3.7.0 is now available! This release has it all: bug fixes, a new method, and a performance improvement! We even dropped our longtime selector engine: Sizzle. Or, I should say, we moved it into jQuery. jQuery no longer depends on Sizzle as a separate project, but has instead dropped its code directly into jQuery core. This helps us prepare for the major changes coming to selection in future jQuery versions. That doesn’t mean much right now, but jQuery did drop a few bytes because Sizzle supports even older browsers than jQuery. As an aside, we do plan on archiving Sizzle, but we’ll have more details on that in a future blog post.

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.7.0.

New method: .uniqueSort()

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

$elem.prevAll().wrapAll("<p/>")

The above would wrap all of the elements as expected, but it would write those elements to the DOM in reverse order. To solve this in a way that prevented breaking existing code, we’ve documented that .prevAll() and similar methods return reverse-order collections, which is still desirable in many cases. But we’ve also added a new method to make things easier: a chainable .uniqueSort(), which does the equivalent of the existing but static jQuery.uniqueSort().

So, our previous example would become:

$elem.prevAll().uniqueSort().wrapAll("<p/>")

and the element order in the DOM would remain the same.

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!

It’s worth noting that jQuery 4.0 will change the way we handle unitless CSS properties. Rather than relying on a list of CSS properties to avoid adding "px", we’ll instead have an list of properties to which we definitely want to add "px" when there are no units passed. That should be more future-proof.

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).

If you’re curious, support for IE will be dropped in jQuery 5.0 and many of those changes are already in a PR.

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.7.0.js

https://code.jquery.com/jquery-3.7.0.min.js

You can also get this release from npm:

npm install jquery@3.7.0

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.7.0.slim.js

https://code.jquery.com/jquery-3.7.0.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, Michal Golebiowski-Owczarek and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 3.7.0

Build

  • Only install Playwright dependencies when needed (212b6a4f)
  • Bump actions/setup-node from 3.5.1 to 3.6.0 (582785e0)
  • Run GitHub Action browser tests on Playwright WebKit (da7057e9)
  • Migrate middleware-mockserver to modern JS (6b2abbdc)
  • remove stale Insight package from custom builds (37b04d5a)

CSS

  • Make `offsetHeight( true )`, etc. include negative margins (#3982, 7bb48a02)
  • Add missing jQuery.cssNumber entries (#5179, 3eed2820)

Deferred

  • Rename `getStackHook` to `getErrorHook` (3.x version) (#5201, cca71186)

Docs

  • Remove stale badge from README (e062f9cb)
  • update irc to Libera and fix LAMP dead link (e0c670e6)

Event

  • Simplify the check for saved data in leverageNative (9ab26aa5)
  • Make trigger(focus/blur/click) work with native handlers (#5015, 754108fb)
  • Simulate focus/blur in IE via focusin/focusout (3.x version) (#4856, #4859, #4950, 59f7b55b)

Release

  • add support for md5 sums in windows (3b7bf199)

Selector

  • Remove an obsolete comment (14685b31)
  • Wrap activeElement access in try-catch (3936cf3e)
  • Stop relying on CSS.supports( “selector(…)” ) (#5194, 63c3af48)
  • Rename rcombinators to rleadingCombinator (ac1c59a3)
  • Make selector lists work with `qSA` again (#5177, 848de625)
  • Implement the `uniqueSort` chainable method (#5166, 0acbe643)
  • Inline Sizzle into the selector module: 3.x version (#5113) (6306ca49)

Tests

  • Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (3.x version) (1a4d87af)
  • Fix tests added in gh-5233 (759232e5)
  • Add tests for arary data in ajax (4837a95b)
  • Skip jQuery.Deferred.exceptionHook tests in IE 9 (98dd622a)
  • Test AJAX deprecated event aliases properly (18139213)
  • Fix selector tests in Chrome (732592c2)
  • Skip the native :valid tests in IE 9 (6b2094da)

jQuery 3.6.4 Released: Selector Forgiveness

Posted on by

If you’ve been following along with recent jQuery releases, we have been working on how to address the recent addition of some new selectors in browsers, especially :has. jQuery 3.6.3 settled on the strategy of using native CSS.supports to determined whether a selector should be passed directly to querySelectorAll or instead go through jQuery’s selector engine, as might be the case when using jQuery selector extensions, complex :not(), or other selectors that are valid in jQuery but not in the browser. That all technically worked fine, but came with a downside. Fortunately for us, the fix is no longer necessary and we can go back to the old way. More on that 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.4.

The Difference Between What Is Right and What Is Allowed

Whenever you use a selector in CSS, or JS, there is more than one spec involved. There’s a spec to determine whether a selector is valid (i.e. Selectors) and there’s a spec to guide implementers in how a selector should be parsed (i.e. the parser algorithm for consuming a simple block). The parser implementation is more forgiving than the selector spec itself, to allow for things like attribute selectors missing the last ] character.

When we addressed an issue with some selectors that were being added to modern browsers—specifically :has—we started making use of another API available in most of our supported browsers—CSS.supports—to determine whether a selector could safely be passed to native querySelectorAll or whether it needed to go through jQuery’s selector engine. Selectors may need to bypass qSA for multiple reasons. It may be a jQuery-only selector extension (:contains), a standard selector that jQuery supports in a more robust way (:not(complex)), or a selector we know to be buggy sometimes (:enabled or :disabled). Whatever the reason, the introduction of “forgiving parsing” in selectors like :has made our previous way of determining that an issue because the browser would no longer throw errors for some truly invalid selectors. For instance, :has(:contains) no longer threw an error when passed to querySelectorAll. Neither did :has(:monkey) for that matter. CSS.supports seemed to be the answer.

And yet, every solution can have a trade-off. The problem now was that selectors that were technically invalid according to the Selectors spec were throwing errors. But these same selectors used to work fine because the parsers were more, for lack of a better term, forgiving. Essentially, CSS.supports is not as forgiving as the parser.

Meanwhile, in our discussions with spec writers and vendors, it was agreed that we needed to prevent issues similar to the one with :has from happening again in the future. What does that mean? It means we can go back to the old way . . . mostly. While the spec has been updated, browsers will need some time to update their implementations. And because of that, we still recommend upgrading jQuery to the latest version.

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.4.js

https://code.jquery.com/jquery-3.6.4.min.js

You can also get this release from npm:

npm install jquery@3.6.4

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.4.slim.js

https://code.jquery.com/jquery-3.6.4.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 Michal Golebiowski-Owczarek and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 3.6.4

Build

  • Update Sizzle from 2.3.9 to 2.3.10 (#5194, dbe09e39)
  • Updating the 3.6-stable version to 3.6.4-pre. (a0d68b84)

jQuery 3.6.3 Released: A Quick Selector Fix

Posted on by

Last week, we released jQuery 3.6.2. There were several changes in that release, but the most important one addressed an issue with some new selectors introduced in most browsers, like :has(). We wanted to release jQuery 3.6.3 quickly because an issue was reported that revealed a problem with our original fix. More details on that 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.3.

Using CSS.supports the right way

After the issue with :has that was fixed in jQuery 3.6.2, we started using CSS.supports( "selector(SELECTOR)") to determine whether a selector would be valid if passed directly to querySelectorAll. When CSS.supports returned false, jQuery would then fall back to its own selector engine (Sizzle). Apparently, our implementation had a bug. In CSS.supports( "selector(SELECTOR)"), SELECTOR needed to be a <complex-selector> and not a <complex-selector-list>. For example:

CSS.supports("selector(div)"); // true
CSS.supports("selector(div, span)"); // false

This meant that all complex selector lists were passed through Sizzle instead of querySelectorAll. That’s not necessarily a problem in most cases, but it does mean that some level 4 selectors that were supported in browsers but not in Sizzle, like :valid, no longer worked if it was part of a selector list (e.g. "input:valid, div"). It should be noted this currently only affects Firefox, but it will be true in all browsers as they roll out changes to CSS.supports.

This has now been fixed in jQuery 3.6.3 and it is the only functional change in this release.

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.3.js

https://code.jquery.com/jquery-3.6.3.min.js

You can also get this release from npm:

npm install jquery@3.6.3

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.3.slim.js

https://code.jquery.com/jquery-3.6.3.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 Michal Golebiowski-Owczarek and the whole jQuery team.

Changelog

Full changelog: 3.6.3

Build

  • remove stale Insight package from custom builds (81d5bd17)
  • Updating the 3.x-stable version to 3.6.3-pre. (2c5b47c4)

Selector

jQuery 3.6.2 Released!

Posted on by

You probably weren’t expecting another release so soon, but jQuery 3.6.2 has arrived! The main impetus for this release was the introduction of some new selectors in Chrome. More on that 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.2.

undefined and whitespace-only CSS variables

jQuery 3.6.1 introduced a minor regression where attempting to retrieve a value for a custom CSS property that didn’t exist (i.e. $elem.css("--custom")) threw an error instead of returning undefined. This has been fixed in 3.6.2. Related to that, we also made sure that whitespace-only values return the same thing across all browsers. The spec requires that CSS variable values be trimmed, but browsers are inconsistent in their trimming. We now return undefined for whitespace-only values to make it consistent with older jQuery and across the different browsers.

.contains() with <template>

An issue was recently reported that showed that a <template>‘s document had its documentElement property set to null, in compliance with the spec. While it made sense semantically for a template to not yet be tied to a document, it made for an unusual case, specifically in jQuery.contains() and any methods relying on it. That included manipulation and selector methods. Fortunately, the fix was simple.

It wasn’t Ralph that broke the internet

The internet experienced a bit of a rumble when Chrome recently introduced some new selectors, the most pertinent of which being :has(). It was a welcome addition, and one celebrated by the jQuery team, but a change to the spec meant that :has() used what’s called “forgiving parsing”. Essentially, even if the arguments for :has() were invalid, the browser returned no results instead of throwing an error. That was problematic in cases where :has() contained another jQuery selector extension (e.g. :has(:contains("Item"))) or contained itself (:has(div:has(a))). Sizzle relied on errors like that to know when to trust native querySelectorAll and when to run the selector through Sizzle. Selectors that used to work were broken in all jQuery versions dating back to the earliest jQuery versions.

And yet, this little drama didn’t last long. The Chrome team quickly implemented a workaround to fix previous jQuery versions in the vast majority of cases. Safari handled their implementation of :has() a little differently and didn’t have the same problem. But, there’s still an important issue open to determine how to address this in the CSS spec itself. The CSSWG has since resolved the issue.

jQuery has taken steps to ensure that any forgiving parsing doesn’t break future jQuery versions, even if previous jQuery versions would still be affected.

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.2.js

https://code.jquery.com/jquery-3.6.2.min.js

You can also get this release from npm:

npm install jquery@3.6.2

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.2.slim.js

https://code.jquery.com/jquery-3.6.2.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 sashashura, Anders Kaseorg, Michal Golebiowski-Owczarek, and the whole jQuery team.

Changelog

Full changelog: 3.6.2

CSS

  • Return undefined for whitespace-only CSS variable values (#5120) (8bea1dec)
  • Don’t trim whitespace of undefined custom property (#5105, c0db6d70)

Selector

Tests

  • Remove a workaround for a Firefox XML parsing issue (965391ab)
  • Make Ajax tests pass in iOS 9 (d051e0e3)

jQuery 3.6.1 Maintenance Release

Posted on by

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.

Changelog

Full changelog: 3.6.1

CSS

  • Skip falsy values in `addClass( array )`, compress code (#4998, 9b34bdb1)
  • Justify use of rtrim on CSS property values (a1373e2e)
  • Remove a redundant extension from rtrimCSS inclusion in curCSS (509eeb89)
  • Trim whitespace surrounding CSS Custom Properties values (#4926, 219ccf5c)

Deprecated

  • Improve $.trim performance for strings with lots of whitespace (69940100)

Docs

  • Update webpack website in README (410d5cf0)
  • add link to preview the new CLAs (b24e83bd)
  • Replace `#NUMBER` Trac issue references with `trac-NUMBER` (95e34b69)
  • remove expired links from old jquery source (c3c4d207)
  • Remove links to Web Archive from source (#4981, 4b0d8900)
  • Update the URL to the latest jQuery build in CONTRIBUTING.md (4bb7d069)
  • Remove the CLA checkbox in the pull request template (93406490)

Event

  • Don’t break focus triggering after `.on(focus).off(focus)` (#4867, b3e4a7eb)

Manipulation

Tests

  • Exclude tests based on compilation flags, not API presence (3.x version) (#5069, bc165128)
  • Workaround an XML parsing bug in Firefox (be3bd560)
  • lock colors version to 1.4.0 (fa70e8fd)
  • Skip ETag AJAX tests on TestSwarm (81fa1e2a)
  • Allow statusText to be “success” in AJAX tests (7439e221)
  • Disable CSS Custom Properties tests in old Safari/iOS (e9f77267)
  • Make Karma browser timeout larger than the QUnit one (a51eec74)
  • Don’t remove csp.log in the cspClean action of mock.php (ba81326f)
  • Load the TestSwarm listener via HTTPS (f6f07204)
  • Switch background image from online file to local 1×1.jpg (8d20cb97)
  • Strip untypical callback parameter characters from mock.php (b14b62c8)

Infrastructure

  • Update GitHub Actions (0f6c3d9e)
  • Add dependabot.yml config (GitHub Actions) (5a363017)
  • Test on Node 17, update Grunt & `karma-*` packages (9bc0df70)
  • Separate the install step from running tests in GitHub Actions (cb35067f)
  • remove travis.yml and travis mentions from core (#4984) (55669883)
  • Migrate CI to GitHub Actions (b39cfa15)
  • Test on Node.js 16 instead of 15 (f12cac60)
  • Take core-js from the external directory as well (752b8981)
  • Updating the 3.x-stable version to 3.6.1-pre. (3642471e)

jQuery 3.6.0 Released!

Posted on by

jQuery 3.6.0 has been released! In jQuery 3.5.0, the major change was a security fix for the html prefilter. This release does not include a security fix, but does have some good bug fixes and improvements. We still have our eyes on a jQuery 4.0 release, but until then we will continue to support the 3.x branch and address important issues.

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.0:

Returning JSON even for JSONP errors

You may have guessed from the minor version that a feature snuck into this release. In previous versions, when a JSONP request responded with an error, often the response was still an executable script. We’ve changed the default behavior to try and execute the response in this situation. Normal scripts will still be skipped when an error is encountered. See gh-4771 for more information.

Fixes

One bug worth highlighting has to do with redirecting focus to another element in a focus handler. Take this example where a focus handler is triggered inside another focus handler:

elem1.on( "focus", function() {
  elem2.trigger( "focus" );
} );

Due to their synchronous nature everywhere outside of IE, a fix added in 3.4.0 to leverage native events caused the native .focus() method to be called last for the initial element, making it steal the focus back. While the code continues to leverage native focus and blur events, we were able to fix this by aligning even more with native methods and only propagating the last focus event up the DOM tree.

Other bug fixes and improvements include a fix for retrieving dimensions on table rows in Firefox, a fix for a crash in Chrome when a focusout event was triggered on a removed element, several improvements to some tests, and more. You’ll find the full changelog below.

Upgrading

Aside from the change to no longer ensure XHTML-compliant tags for you, we do not expect other 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.0.js

https://code.jquery.com/jquery-3.6.0.min.js

You can also get this release from npm:

npm install jquery@3.6.0

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.0.slim.js

https://code.jquery.com/jquery-3.6.0.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 Dallas Fraser, Michal Golebiowski-Owczarek, Wonseop Kim, Wonhyoung Park, Beatriz Rezener, Natalia Sroka, and the whole jQuery team.

Changelog

Full changelog: 3.6.0

Ajax

Core

Deferred

Dimensions

  • Modify reliableTrDimensions support test to account for FF (#4529, bcd40aa7)

Docs

  • Change JS Foundation mentions to OpenJS Foundation (db43ef0b)

Event

Selector

Support

  • ensure display is set to block for the support div (#4844) (#4832, f8bdb127)

Tests

  • Fix tests for not auto-executing scripts without dataType (7298e04f)
  • Skip the jQuery.parseXML error reporting test in Legacy Edge (bf06dd47)
  • Fix the jQuery.parseXML error reporting test (1ec36332)
  • Recognize callbacks with dots in the Node.js mock server (4c572a7f)
  • Skip the “jQuery.ajax() on unload” test in Safari (4f016c64)
  • Remove an unused local variable (beea433d)
  • Remove remaining obsolete jQuery.cache references (5e028c76)
  • Remove obsolete jQuery data tests (8ad78cdb)

jQuery 3.5.1 Released: Fixing a Regression

Posted on by

I’ve never gotten to say this on a jQuery release, but May the 4th be with you! A short time ago in a galaxy exactly like this one, we released jQuery 3.5.0. We have a quick fix for a regression in that release.

Specifically, we had changed our internal data object to use Object.create( null ) instead of a plain object ({}). We did that to prevent collisions with keys on Object.prototype properties. However, this also meant that users (especially plugins) could no longer check what was in jQuery data with the native .hasOwnProperty() method, and it broke some code. We’ve reverted that change, but plan to put it back in jQuery 4.0. This change is the only code change in this release. Other changes include some minor updates to our docs and build system.

Security fixes in 3.5.0

jQuery 3.5.0 included fixes for two security issues in jQuery’s DOM manipulation methods, as in .html(), .append(), and the others. Security advisories for both of these issues have been published on GitHub. While we provided all of the details on the first issue in the jQuery 3.5.0 blog post, we did not provide all of the details on the second and would like to do that in this post.

The second issue was very similar to the first. It was an XSS vulnerability that had to do with passing <option> elements to jQuery’s DOM manipulation methods. Essentially, we’re using a regex to wrap <option> elements with <select> elements to ensure those elements get parsed correctly in old IE (IE <= 9 replaces any <option> tags with their contents when inserted outside of a <select> element).

Our fix is to only apply this code where it is needed. Fortunately, because of the different parsing behavior in IE9, we can keep the fix in IE9 without exposing it to the same vulnerability as other browsers. Please upgrade when you get a chance to avoid these vulnerabilities.

Upgrading

If you haven’t yet upgraded to jQuery 3.5, have a look at the 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide. Also, the jQuery Migrate plugin will help you to identify compatibility issues in your code.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions. Please try out this new release and let us know about any issues you experienced.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.5.1.js

https://code.jquery.com/jquery-3.5.1.min.js

You can also get this release from npm:

npm install jquery@3.5.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.5.1.slim.js

https://code.jquery.com/jquery-3.5.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 Pierre Grimaud, Michal Golebiowski-Owczarek, Ed S, vanillajonathan, and the whole jQuery team.

Changelog

Full changelog: 3.5.1

Build

  • Test on Node.js 14, stop testing on Node.js 8 & 13 (205dd134)
  • Enable reportUnusedDisableDirectives in ESLint (b21d6710)
  • Updating the 3.x-stable version to 3.5.1-pre. (898784ab)

Data

Docs

Tests

  • Workaround failures in recent XSS tests in iOS 8 – 12 (ea2d0d50)
  • Add tests for recently fixed manipulation XSS issues (58a8e879)
  • Cleanup `window` & `document` handlers in a new event test (c1c0598d)
  • Fix flakiness in the “jQuery.ajax() – JSONP – Same Domain” test (46ba70c5)

jQuery 3.5.0 Released!

Posted on by

jQuery 3.5.0 has been released! 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.

We hope you’re staying healthy and safe while so many of us are stuck at home. With a virus ravaging the planet, we realize that jQuery may not be a high priority for you or the sites you manage. When you do have a moment, we recommend that you review this new version and upgrade.

Security Fix

The main change in this release is a security fix, and it’s possible you will need to change your own code to adapt. Here’s why: jQuery used a regex in its jQuery.htmlPrefilter method to ensure that all closing tags were XHTML-compliant when passed to methods. For example, this prefilter ensured that a call like jQuery("<div class='hot' />") is actually converted to jQuery("<div class='hot'></div>"). Recently, an issue was reported that demonstrated the regex could introduce a cross-site scripting (XSS) vulnerability.

The HTML parser in jQuery <=3.4.1 usually did the right thing, but there were edge cases where parsing would have unintended consequences. The jQuery team agreed it was necessary to fix this in a minor release, even though some code relies on the previous behavior and may break. The jQuery.htmlPrefilter function does not use a regex in 3.5.0 and passes the string through unchanged.

If you absolutely need the old behavior, using the latest version of the jQuery migrate plugin provides a function to restore the old jQuery.htmlPrefilter. After including the plugin you can call jQuery.UNSAFE_restoreLegacyHtmlPrefilter() and jQuery will again ensure XHTML-compliant closing tags.

However, to sanitize user input properly, we also recommend using dompurify with the SAFE_FOR_JQUERY option to sanitize HTML from a user. If you don’t need the old behavior, but would still like to sanitize HTML from a user, dompurify should be used without the SAFE_FOR_JQUERY option, starting in jQuery 3.5.0. For more details, please see the 3.5 Upgrade Guide.

Features

With what we call “positional selectors” being deprecated and slated for removal in jQuery 4.0, we’ve added the last two necessary replacement methods. Specifically, we’ve added the .even() and .odd() methods to replace the :even and :odd selectors. With these methods in place, we can safely remove these overly complicated selectors in jQuery 4.0.

Another small feature that we’ve added to this release is the ability to add a context to jQuery.globalEval. This was done as part of fixing a bug with script execution in iframes.

Fixes

One bug worth highlighting is a bug we fixed in the Ajax script transport. jQuery used to evaluate any response to a request for a script as a script, which is not always the desired behavior. This is different than other data types where such a convention was fine (e.g. in the case of JSON). jQuery 3.5.0 will now only evaluate successful HTTP responses.

Other bug fixes and improvements include performance improvements in Sizzle, support for massive arrays in jQuery.map, using the native .flat() method where supported, a fix for syntax errors in the AMD modules, several improvements to our testing infrastructure, and more. You’ll find the full changelog below.

Deprecations

It wouldn’t be a jQuery release without some deprecations. In jQuery 3.5.0, we’ve put jQuery.trim on the list. JavaScript’s own String.prototype.trim() is an easy replacement for it.

We’ve also put AJAX event aliases on the list, they can be replaced by .on("ajaxStart", …) and the like. jQuery Migrate will warn about these now-deprecated methods, but they’ll stick around until jQuery 4.0.

Upgrading

Aside from the change to no longer ensure XHTML-compliant tags for you, we do not expect other 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.5.0.js

https://code.jquery.com/jquery-3.5.0.min.js

You can also get this release from npm:

npm install jquery@3.5.0

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.5.0.slim.js

https://code.jquery.com/jquery-3.5.0.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 Ahmed S. El-Afifi, Michal Golebiowski-Owczarek, Wonseop Kim, Dave Methvin, Shashanka Nataraj, Pat O’Callaghan, Sean Robinson, Christian Oliff, Christian Wenz, and the whole jQuery team.

We also would like to thank Masato Kinugawa for helping us identify and fix the security-related issues in this release.

Changelog

Full changelog: 3.5.0

Ajax

  • Do not execute scripts for unsuccessful HTTP responses (#4250, #4655, da3dd85b)
  • Overwrite s.contentType with content-type header value, if any (#4119, 065143c2)
  • Deprecate AJAX event aliases, inline event/alias into deprecated (7a3cf9c0)

Build

  • Resolve Travis config warnings (7506c9ca)
  • Enable ESLint one-var rule for var declarations in browser code (0fdfdd82)
  • Test the no-Sizzle build on Travis (362075ae)
  • Update .mailmap & AUTHORS.txt (19f2dcba)
  • Tests: Fix custom build tests, verify on Travis; name Travis jobs (d525ae34)
  • Lint the minified jQuery file as well (#3075, 37df5cdf)
  • Make Karma work in AMD mode (46c284b1)
  • Create a `grunt custom:slim` alias for the Slim build (4cbdc745)
  • Run tests on Travis only on browsers defined in the config (471b0043)
  • Run tests on Firefox ESR as well (0a73b94a)
  • Run tests on Node.js 13 in addition to 8, 10 & 12 (64c1fcc1)
  • Drop workarounds for Node.js 6 in Gruntfile.js (9f4204ec)
  • Run tests on Travis on FirefoxHeadless as well (ad3c2efa)
  • Require strict mode in Node.js scripts via ESLint (ac2da4e6)
  • Support jquery-release –dry-run flag (c7a5e1bd)
  • Stop copying src/core.js to dist on release (#4489, 279d2e97)
  • ESLint: forbid unused function parameters (d7e13f12)
  • Fix the regex parsing AMD var-modules (#4389) (36b59c96)

Core

  • Ajax: Align nonce & global with master, fix an AMD issue (22bf701f)
  • Fire iframe script in its context, add doc param in globalEval (#4518, 3dedc3f2)
  • Deprecate jQuery.trim (#4363, 56e73e0c)
  • Use Array.prototype.flat where supported (#4320, 2f666c1d)
  • Implement .even() & .odd() to replace POS :even & :odd (409cbda7)

CSS

  • Workaround buggy getComputedStyle on table rows in IE/Edge (#4490, 6d31477a)

Data

  • Event:Manipulation: Prevent collisions with Object.prototype (#3256, 413ff796)

Docs

  • Update links to EdgeHTML issues to go through Web Archive (d72faced)
  • Convert link to Homebrew from HTTP to HTTPS (ff5a43eb)

Effect

  • Fix a unnecessary conditional statement in .stop() (#4374, 30f5c6c3)

Event

  • Use only one focusin/out handler per matching window & document (#4652, 9e15d6b4)
  • Only attach events to objects that accept data – for real (#4397, f36f6abb)

Manipulation

  • Skip the select wrapper for option elements
  • Make jQuery.htmlPrefilter an identity function (1d61fd94)

Offset

Selector

Tests

  • Blacklist one focusin test in IE (1a4f10dd)
  • Pass a number of necessary done() calls to assert.async() (5ea844f6)
  • Make the support tests pass on Firefox 4x/5x/60 (f0d5ec62)
  • Skip a “width/height on a table row with phantom borders” test in Firefox (c79e1d5f)
  • Don’t test synchronous XHR on unload in Chrome (c5b48c8c)
  • Fix offset fractions tests in Chrome for Android (0c67da4b)
  • Move Android user agent detection above iOS, put Safari last (6276cb2e)
  • Make support tests accept Safari 13 & newer (8167327f)
  • update npo.js and include unminified source instead (3654bc83)

Traversing

  • Fix contents() on object elements with children in IE (90f78b9a)
  • Fix contents() on object elements with children (#4384, 42badf34)

jQuery 3.4.1: triggering focus events in IE and finding root elements in iOS 10

Posted on by

Hello again! jQuery 3.4.0 was released just three weeks ago, but we’ve had a few issues reported that warranted a patch release. Thank you to everyone that reported issues and helped us get these fixed quickly. Here are the changes:

Triggering focus or blur more than once in IE

jQuery 3.4.0 came with some changes to the way the event handler triggered native events such focus and blur. These changes caused a regression that sometimes resulted in an enigmatic error being thrown in the form of "saved.shift is not a function". This is now fixed.

Example

// Error thrown in IE10-11
// after clicking #test-element twice
jQuery("#test-element").click(function() {
  jQuery(this).trigger("blur");
});

Checking element attachment in iOS 10.0-10.2

When releasing 3.4.0, we ran our tests in several versions of iOS, including iOS 10.3 but not 10.0-10.2. Those versions do not support a native function we use to determine whether an element is attached to the DOM. Other versions of iOS were not affected. We added a guard to ensure that this method exists and fall back to other options if necessary.

Loading jQuery with AMD

A small module was added in jQuery 3.4.0 that used the global jQuery rather than the local jQuery loaded with AMD. This resulted in "jQuery is undefined" errors when loading with AMD, but this should now be fixed.

 


Upgrading

There should be no compatibility issues if upgrading from jQuery 3.0+. If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.4.1.js

https://code.jquery.com/jquery-3.4.1.min.js

You can also get this release from npm:

npm install jquery@3.4.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.4.1.slim.js

https://code.jquery.com/jquery-3.4.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 Richard Gibson, Michal Golebiowski-Owczarek, and the whole jQuery team.

Changelog

GitHub changelog: Issues fixed in 3.4.1 | All changes

Build

  • Fix unresolved jQuery reference in finalPropName (#4358, 0d4af529)

Core

Event

  • Prevent leverageNative from registering duplicate dummy handlers (6c1e7dbf)
  • Fix handling of multiple async focus events (#4350, 24d71ac7)

jQuery Community Updates 10/26

Posted on by

Updates From jQuery Core

I’ve got some good news today about the next version of jQuery: jQuery 1.4.4. On the heels of the 1.4.3 release, which included many fixes (and of course the introduction of jQuery Mobile), we felt it would be of most benefit to the community if we were to make a maintenance release soon after, aimed to further improve the stability of the jQuery core.

For 1.4.4, we’ve identified those bugs that were most critical for us to fix and thanks to John Resig and the bug triage team, we’ve already fixed the majority of these issues. We currently intend on releasing 1.4.4 in early November, assuming no further major bugs are targeted for this release.

Today, we would like to ask the community to assist us in ensuring this new release is as stable as possible through stress-testing it. While we already run a comprehensive suite of automated unit tests on jQuery, adding real-world user testing into our project flow allows us the opportunity to fix critical bugs sooner and will assist in 1.4.4 being a significant improvement over the last release.

If you would like to test 1.4.4, you can download an up-to-the-minute version of it (dubbed jQuery Git) here:

http://code.jquery.com/jquery-git.js

Please bear in mind that this version is not yet ready for production systems and is only made available for evaluation and testing. It is also now available on jsFiddle.net under the entry ‘jQuery 0 Git’.

We appreciate the community’s assistance in helping us make this release as stable as possible and welcome any feedback you may have on it. If you notice a bug in this release and would like to report it, please see the guidelines on bug submission.

Updates From the jQuery UI Team

The developers from the jQuery UI team stayed in Boston for three days after the conference and were able to fix quite a few bugs and do some face-to-face planning on the future of jQuery UI. jQuery UI 1.8.6 is nearing a release date very soon, so keep an eye on the jQuery UI blog for it.

Additionally, the jQuery UI team is working with Colin Snover to migrate jQuery UI’s ticket system over to a new system like jQuery Core just received. We are really excited about having a more stable and collaborative ticket tracking system and would love more contributions from the community helping in ticket triage. If you are interested in contributing, please talk to a jQuery Developer Relations team member.

The Official jQuery Podcast with Ralph Whitbeck and Rey Bango released their 37th episode last week. Their guest this week was Ben Nadel and they discussed jQuery in the ColdFusion community as well as talk about the jQuery Conference that took place in Boston last weekend. This week they’ll be interviewing John Resig about jQuery 1.4.3 and jQuery Mobile. If you have any questions you would like answered please send your question via the contact form.

Don’t forget about our forums. We have a vibrant community asking and answering questions. We would love more people contributing by helping others out in answering questions. It’s a great way to get involved in the project; being able to give your knowledge back to others is very rewarding.