jQuery 4.1.0 is now available, alongside version 3.8.0, released on November 17. Both fix a ReDoS flaw in selector parsing that could leave a page unresponsive; the new version of the 4.x branch also includes changes to AJAX, forms, and element searches.
The joint release marks a turning point: active development is moving to 4.x. The jQuery team describes 3.8.0 as “a send-off, not a comeback” and announces that the 3.x branch will receive only critical security and bug fixes. For those still using earlier versions, the team recommends consulting its upgrade guide and using the jQuery Migrate plugin.
“a send-off, not a comeback”
— jQuery team
A malformed selector could block the page
The issue fixed affects the regular expression jQuery uses to recognize identifiers within selectors. According to the team, a long string of hexadecimal escapes followed by an invalid character could trigger catastrophic backtracking during a search. As a result, the page could become blocked while processing that input.
The change adjusts which characters a part of the regular expression accepts, in line with CSS rules. The fix is included in both branches: both 4.1.0 and 3.8.0 include it. The outlet iThome also describes the flaw as a ReDoS that could consume resources and leave the page unresponsive when given a specially crafted sequence.
WPS tested the regression with a selector input containing 30 hexadecimal escapes followed by an invalid character. In its environment, jQuery 4.0.0 was still running after 120 seconds, so the test was stopped; jQuery 4.1.0 finished in 4 milliseconds with a syntax error. Those timings are from WPS's test, not a measurement published by the jQuery team.
AJAX gets a final URL and a more flexible callback
In jQuery 4.1.0, jqXHR objects expose responseURL, which contains the final request URL after any redirects followed by the browser. The property is not available in all transports: the official blog notes that it is provided by XHR in modern browsers, but not by Internet Explorer 11 or script and JSONP transports.
Both versions also offer an alternative for the completion callback of custom AJAX transports. Until now, it received positional arguments—status, status text, responses, and headers—but it can now receive that data in a single object. The object makes it possible to add parameters in the future without relying on argument order, and lets each transport provide only the fields it can supply. jQuery 4.1.0 already uses this capability to include responseURL.
More changes to selectors and forms
The library no longer uses getElementsByTagName and getElementsByClassName internally as search methods, and instead uses querySelectorAll. According to jQuery, the static list returned by this method avoids the need to copy a live collection. The change also fixes known issues, including the selection of MathML elements with lowercase tag names in cloned Internet Explorer 11 nodes, and selectors that begin with combinators in document fragments.
Selector work includes stricter fast paths for recognizing simple selectors, with a fallback to normal searching if querySelectorAll throws an exception. Invalid escapes are also decoded as U+FFFD, the replacement character required by the CSS specification. The changelog also mentions a fix for an issue in Safari 27's regular expression engine.
uniqueSort now removes duplicates using a one-pass compaction with two pointers, instead of repeatedly removing items with splice. The team says behavior and ordering remain unchanged, but the cost of removing duplicates falls from O(N²) to O(N), with constant additional space. The improvement is especially noticeable when processing large, disconnected sets.
The release also fixes CSS support in XML documents that are not XHTML, such as those transformed with XSLT. In these documents, elements created with document.createElement may end up in the XML namespace and lack the style property; jQuery now creates these elements internally with createElementNS and the XHTML namespace.
In form serialization, custom elements associated with a form—registered with formAssociated = true—are now processed correctly by .serialize() and .serializeArray(). The library trusts elements included in form.elements as fields that can be submitted, rather than discarding them because they do not match a known HTML tag.
The 3.x branch will no longer receive features
Version 3.8.0 brings together fixes that had been accumulating for years in the stable 3.x branch; some had already made it into jQuery 4.0.0. The team emphasizes that it is not resuming feature development for 3.x: from this release onward, that branch is limited to critical bugs and security issues, while active work continues in 4.x.
One of the features specific to 3.x is support for the until-found value of the hidden attribute. Previous normalization of boolean attributes could alter this value; now .attr("hidden", "until-found") preserves it as is. The same change was not needed in 4.x because boolean attribute handling had already been changed to avoid this issue.
Version 3.8.0 also deprecates two groups of APIs removed in 4.0.0. One includes the array methods push, sort, and splice on the jQuery prototype, which the project itself no longer used. The other includes jQuery.expr[":"] and jQuery.expr.filters; for custom selectors, the recommended alternative is jQuery.expr.pseudos.
By deprecating these APIs in 3.x, jQuery Migrate can warn about their use before a project switches to 4.x. Version 3.8.0 also incorporates fixes already released in 4.0.0, including improvements to cleaning up elements with jQuery.cleanData, table column dimensions, and native event handling.
Versions and upgrade paths
The team released both versions on the jQuery CDN and npm. Slim builds are also available, both regular and minified; other CDNs may take time to add them because their release schedules are independent of the project.
| Version | Available channel | Branch status |
|---|---|---|
| jQuery 4.1.0 | Official CDN, npm, and slim builds | Active 4.x development |
| jQuery 3.8.0 | Official CDN, npm, and slim builds | Last planned feature update; critical fixes only thereafter |
To install from npm, the team recommends npm install [email protected] or npm install [email protected]. It also publishes minified and unminified files on the official CDN. The recommendation for those who have not yet migrated is to review the 4.x upgrade guide and use jQuery Migrate; according to the team, most users will be able to upgrade with minimal changes.
The release thanks those who submitted patches, reported bugs, or tested the versions, and names Richard Gibson, Michał Gołębiowski-Owczarek, Timo Tijhof, and TomTensor among the contributors, along with the rest of the jQuery team. With 3.8.0, the old branch moves to critical maintenance; 4.1.0 is the actively developed line.
Sources: blog.jquery.com, GitHub, jQuery, iThome, Linux Compatible, WPS