jQuery 4.0 has been released after almost 10 years since the publication of the 3.0 branch and 20 years after the founding of the project jQuery, which is used by 70.9% of the 10 million most visited sites on the Internet according to W3Techs. The jQuery code is distributed under the MIT license.
The new jQuery 4.0 release includes changes that break backward compatibility, but developers assure that most users can safely upgrade to the new version with minimal changes to their code. A special plugin can be used to simplify migration. The backward compatibility violations involve the removal of deprecated code, some internal undocumented options, unnecessarily complex behavior, and APIs that were previously deprecated. By removing outdated APIs and browsers, the size of the library’s gzip archive has been reduced by 3 KB (the slim version now occupies 19.5 KB, and full version – 27.5 KB).
Some of the changes in jQuery 4.0 include:
- Discontinuation of support for IE 10 and older browsers, as well as other older browsers such as Edge Legacy, Android Browser, and Firefox up to branch 115. Support for IE 11 will be retained but removed in jQuery 5.0.
- Built-in support for the Trusted Types API to protect against DOM manipulation leading to cross-site scripting (DOM XSS).
- Translation of jQuery code to use ESM JavaScript modules and can be supplied and imported as a module.
- Removal of previously marked as deprecated functions and undocumented internal methods.
- Updates to the order of processing focus change events according to W3C specification.
- Reduction in size of the stripped-down version.
For more information on the jQuery 4.0 release, you can visit the official blog post.