jQuery 4.1.0 is out, and its GitHub release page collected more than 360 points on Hacker News. The release brings small but useful additions, a few removals and hardening fixes on the selector side.
New features
- Ajax: A
responseURLfield was added to jqXHR (#4339). - Ajax: An alternative completeCallback API for transports.
- Serialize: Support for form-associated custom elements (#5245).
Removals
The getElementsByTagName and getElementsByClassName helpers were removed from core in favor of querySelectorAll (#3642). The release notes list no other breaking change, but if your code relies on those methods directly, search for them before upgrading.
Notable fixes
- Selector: A ReDoS issue in identifier matching was fixed, quick selection paths are stricter, invalid escape code points decode to U+FFFD (#5845), and a Safari 27 regex interpreter bug has a workaround.
- CSS:
createElementNSis used to support XML documents (#4730), and the probe table for table style tests is emptied when it may be reused (#5932). - Core: Loops were refactored to avoid going past array bounds.
- Performance: Duplicate removal in
jQuery.uniqueSortwas optimized.
Other changes
The docs add TuxCare as a commercial support vendor and introduce guidelines for machine-generated contributions. Tests were updated, with new ones for jQuery.ajaxPrefilter, jQuery.ajaxTransport, .data() on SVG elements and the serialize module.
Upgrade advice
- Search your code for jQuery-based use of
getElementsByTagNameandgetElementsByClassNamehelpers. - Test any custom code that deals with selector escape characters.
- Compare your Ajax and serialize flows before and after the upgrade.
Source: jQuery 4.1.0 release notes.