jQuery 3.7.1 Released: Reliable Table Row Dimensions

Posted on by

jQuery 3.7.1 has been released! This release fixes a regression from jQuery 3.6.0 that resulted in rounded dimensions for <tr /> elements in Chrome and Safari. Also, a (mostly) internal Sizzle method, jQuery.find.tokenize that was on the jQuery object was accidentally removed when we removed Sizzle in jQuery 3.7.0. That method has been restored.

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

Support Test for Table Rows

jQuery 3.6.0 introduced a change to a support test to account for a sudden failure from Firefox, which started including table borders in computed dimensions for <tr /> elements. That may be actually be correct, but Firefox is the only browser doing it. However, that new support test didn’t account for pages with * { box-sizing: border-box; } in CSS. And so, the support test failed on those pages in all browsers. The result was a fallback to use outerWidth and outerHeight, which unfortunately doesn’t return fractional values. The support test has now been fixed and previous behavior has been restored for Chrome and Safari, but Firefox and IE will continue to return integers.

Re-exposing Methods from Sizzle

jQuery has inlined most of the code from Sizzle in jQuery 3.7.0 in preparation for larger changes coming to the jQuery selector engine in the future. For the most part, there were no functional changes, but we did accidentally privatize a method that used to be public. While jQuery.find.tokenize was not documented, some code relied on it being available. That method has now been restored.

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

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

You can also get this release from npm:

npm install jquery@3.7.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.7.1.slim.js

https://code.jquery.com/jquery-3.7.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 Gabriela Gutierrez, Michal Golebiowski-Owczarek, Timo Tijhof, Dimitri Papadopoulos Orfanos 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.1

Build

  • Generate the slim build on `grunt` & run `compare_size` on it (763ade6d)
  • Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well (3c18c1f3)
  • switch preferred email for timmywil (72ae577c)
  • Build: Bump actions/checkout from 3.5.2 to 3.5.3 (a370d7df)
  • Reference GitHub Actions by commit SHAs (#5266, 0ea85dad)
  • Test on Node.js 20, stop testing on Node.js 14 & 19 (b473729d)
  • Updating the 3.x-stable version to 3.7.1-pre. (64460dac)

Core

  • Fix regression in jQuery.text() on HTMLDocument objects (#5264, 44c56f87)

CSS

  • Make the reliableTrDimensions support test work with Bootstrap CSS (3.x version) (#5270, a288838c)

Deprecated

  • Define `.hover()` using non-deprecated methods (7287894f)

Docs

  • Fix typos found by codespell (4a29888c)
  • remove stale gitter badge from readme (141518e9)
  • Remove the “Grunt build” section from the PR template (992a6653)

Release

Selector

  • Only attach the unload handler in IE & Edge Legacy (#5281, 87467a6f)
  • Re-expose jQuery.find.tokenize (3.x version) (#5259, 13a870b6)

Tests

  • Disable the “:lang respects escaped backslashes” test (#5271, 5aa7d93a)
  • Skip a new `.text()` test in IE 9 (b84146ce)

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)