What’s New in jQuery 4.0? Major Changes, Size Cut, and Trusted Types Support
jQuery 4.0, the first major release in a decade, drops IE 10 support, switches to ES modules, removes obsolete APIs, shrinks the library by over 3 KB, adds Trusted Types protection, and sparks mixed opinions about the future relevance of the once‑ubiquitous JavaScript library.
jQuery’s core team recently launched version 4.0, described by lead developer Timmy Willison as the first major release in ten years.
Key Compatibility Changes
The new version ends support for legacy browsers such as Internet Explorer 10, older Edge (pre‑Chromium), older Firefox, and outdated Android and iOS browsers. It also adopts native ECMAScript (ES) modules, aligning the library with modern JavaScript standards.
API Reductions and Size Improvements
Several APIs have been removed not because they are deprecated, but because modern browsers now provide native equivalents. This streamlining reduces the gzipped size of jQuery by more than 3 KB. A “slim” build that omits Ajax and animation modules is even smaller, weighing in at roughly 8 KB.
Event‑Handling Adjustments
Historically, browsers differed in the order of focus‑related events (focus, focusin, focusout, blur). jQuery previously normalized these discrepancies. With the W3C specification now widely implemented, browsers follow a consistent event order, and jQuery now defers to native behavior, which may affect code that relied on its overrides.
Trusted Types Integration
jQuery 4.0 adds support for Trusted Types, a browser security feature that mitigates cross‑site scripting (XSS) by preventing unsafe assignments to properties like .innerHTML. Earlier jQuery versions could violate Content‑Security‑Policy (CSP) rules, but the new release resolves this issue.
Historical Context and Adoption
Created by John Resig two decades ago, jQuery solved pervasive browser‑compatibility headaches, allowing developers to use concise selectors such as $("#myspan") instead of document.getElementById("myspan"). According to w3techs, about 88 % of sites using JavaScript libraries (≈70.9 % of all websites) still include jQuery.
Community Opinions
Some developers argue that native JavaScript now offers comparable performance and that the library’s relevance is waning, especially since 19 % of sites still run a ten‑year‑old version. Others contend that jQuery remains the most reasonable JavaScript library for many projects, citing its concise syntax and ease of use.
Conclusion
jQuery 4.0 modernizes the library, reduces its footprint, and improves security, but the decision to adopt it depends on project requirements, browser support targets, and whether developers prefer native APIs over a familiar abstraction.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
