Twenty years after its introduction, the jQuery team has released version 4.0.0. The first major release in almost 10 years brings significant improvements, modernizations, and breaking changes. Many users can upgrade with minimal changes to their code.
Version 4.0.0 is intended to mark a new phase for the JavaScript library. The release follows a long development cycle with several pre-releases. The breaking changes are changes that the team has wanted to implement for years but was unable to do so in patch or minor releases. Legacy code has been cleaned up, previously deprecated APIs have been removed, and support for some “magic” behaviors that were too complex has been scrapped. An upgrade guide and jQuery Migrate plugin are available to support the transition.
Support for old browsers is disappearing
Version 4.0 drops support for Internet Explorer 10 and older. IE 11 will continue to be supported for the time being, but will disappear in jQuery 5.0. The team has opted for a phased approach. Edge Legacy, iOS versions older than the last three, Firefox versions older than the last two (except Firefox ESR), and Android Browser are also no longer supported.
The library does add support for Trusted Types and Content Security Policy. HTML wrapped in TrustedHTML can now serve as input for jQuery manipulation methods without violating the require-trusted-types-for CSP directive. Most asynchronous script requests now use <script> tags instead of inline scripts to avoid CSP errors.
Migration to ES modules and removed features
The jQuery source on the main branch has been migrated from AMD to ES modules. This makes the library compatible with modern build tools, development workflows, and browsers. Rollup replaces RequireJS as the build tool, and all tests run separately on the ES modules.
Removed functions include jQuery.isArray, jQuery.parseJSON, jQuery.trim, jQuery.type, jQuery.now, jQuery.isNumeric, jQuery.isFunction, jQuery.isWindow, jQuery.camelCase, jQuery.nodeName, jQuery.cssNumber, jQuery.cssProps, and jQuery.fx.interval. Native equivalents such as Array.isArray(), JSON.parse(), String.prototype.trim(), and Date.now() can replace these.
The internal methods push, sort, and splice have also been removed from the jQuery prototype. These were always intended for internal use. The combination of removed APIs and IE code reduced the size by over 3 kilobytes, gzipped.
The release is available via the jQuery CDN and npm. Third-party CDNs will need some time to make the files available.