jQuery Releases v4: First Major Version in Almost 10 Years
Summary
jQuery has released version 4.0.0, its first major update in nearly a decade, coinciding with the library's 20th anniversary. This release focuses on modernization by removing legacy code, deprecating old APIs, and dropping support for Internet Explorer 10 and older browsers, though IE11 is still supported for now. Key changes include migrating the source code to ES modules, enabling compatibility with modern build tools like Rollup, and enhancing security with Trusted Types support. Performance improvements stem from removing deprecated functions, which saved over 3,000 bytes of gzipped code, and reducing the slim build to approximately 19.5k bytes gzipped by eliminating Deferreds and Callbacks in favor of native Promises.
Key takeaway
For web developers maintaining or extending existing applications, upgrading to jQuery 4.0 offers significant modernization and performance gains with minimal code changes. Your projects will benefit from enhanced security features like Trusted Types and compatibility with modern ES module-based build workflows. Consider this update to keep your codebase current and leverage native browser APIs, reducing dependency overhead.
Key insights
jQuery 4.0 modernizes the library by shedding legacy code and embracing ES modules while retaining its core simplicity.
Principles
- Prioritize lean codebases.
- Embrace native browser APIs.
- Maintain backward compatibility where feasible.
Method
Modernize JavaScript libraries by removing deprecated APIs, dropping support for outdated browsers, and migrating to ES modules for better build tool integration.
In practice
- Use `npm install jquery@4.0.0` for new projects.
- Consult the jQuery 4.0 upgrade guide.
- Utilize the jQuery Migrate plugin for existing codebases.
Topics
- jQuery 4.0.0
- JavaScript Libraries
- Web Development
- ES Modules
- Browser Compatibility
Code references
Best for: Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by InfoQ.