jQuery 4.0 Released: First Major Update in a Decade

▼ Summary
– jQuery 4.0 is the first major update in nearly a decade, released on the library’s 20th anniversary.
– The update modernizes the library by removing legacy code, deprecated APIs, and support for outdated browsers like IE10.
– Key technical changes include migrating source code to ES modules and adding support for Trusted Types to improve security and compatibility.
– The community reaction is mixed, with some praising its simplicity for existing projects and others questioning its use in new applications.
– Despite the rise of modern frameworks, jQuery remains valued for maintaining large codebases, cross-browser normalization, and enabling simple interactivity.
After a decade of anticipation, the jQuery team has officially launched jQuery 4.0, a landmark release that coincides with the library’s twentieth anniversary. This major update modernizes the foundational JavaScript toolkit while preserving the straightforward developer experience that made it a web development staple. The focus has been on shedding legacy weight, excising outdated APIs, and ending support for obsolete browsers, culminating in a significantly leaner and faster library. For most existing projects, the upgrade path should be straightforward, aided by detailed documentation and the jQuery Migrate plugin.
A pivotal shift in jQuery 4.0 is the formal end of support for Internet Explorer 10 and other legacy browsers, including the original Microsoft Edge, older iOS versions, and the Android Browser. Notably, Internet Explorer 11 retains compatibility for now, though the development team has signaled its removal will come with the eventual jQuery 5.0 release. This move allows the library to streamline its codebase and fully embrace contemporary web standards.
Under the hood, the project has undergone a substantial architectural overhaul. The source code has transitioned from AMD modules to native ES modules, aligning jQuery with modern build tools and development practices. Developers can now import jQuery directly using `script type=”module”` tags. To support this new structure, the packaging system has switched from RequireJS to Rollup.
The community’s response highlights a broader trend in web development. As one observer noted, the extensive list of removed features underscores just how capable native browser JavaScript has become. The update introduces support for Trusted Types, a crucial security enhancement. This allows HTML wrapped in `TrustedHTML` objects to be used with jQuery’s manipulation methods without triggering Content Security Policy violations. Additionally, the library now prefers using `script` tags over inline scripts for asynchronous requests, further reducing CSP conflicts.
This version eliminates several deprecated functions whose native browser equivalents are now universally reliable. Removals include `jQuery.isArray`, `jQuery.parseJSON`, `jQuery.trim`, and `jQuery.now`. Developers should transition to `Array.isArray()`, `JSON.parse()`, `String.prototype.trim()`, and `Date.now()`. Pruning these and other deprecated APIs has shaved over three kilobytes from the gzipped file size.
The slim build of the library has been reduced even further, now weighing approximately 19.5k bytes when gzipped. This was achieved by removing the `Deferreds` and `Callbacks` modules, as the native `Promise` object is available across all currently supported browser environments except IE11.
Discussion around the release has sparked conversation about jQuery’s ongoing role. When questioned about its use in new projects, community members pointed to its enduring strengths. Many emphasized that jQuery remains a powerful tool for maintaining or extending large legacy codebases. Its advantages include rapid DOM manipulation with minimal cognitive load, reliable cross-browser normalization, and the ability to add small interactive features without adopting a full framework. The massive ecosystem of existing plugins continues to function, and the syntax offers excellent readability, especially for those less specialized in modern JavaScript.
For scenarios involving progressive enhancement, server-rendered sites, or when simplicity is paramount, jQuery provides a battle-tested solution. It offers a predictable and stable foundation in a landscape often dominated by rapidly changing frameworks. The library is available for immediate use via the jQuery CDN or through npm with the command `npm install jquery@4.0.0`. This release stands as both a technical evolution and a celebration of two decades of simplifying web development for a global audience of programmers.
(Source: InfoQ)