jQuery 4 FINALLY released... (What!?)

BBetter Stack
Internet TechnologyAdult EducationComputing/Software

Transcript

00:00:00jQuery 4 is finally here, and no don't worry you haven't travelled back in time, this is
00:00:04just our first major version update since 2016, it's been in beta for 2 years and it
00:00:09comes 20 years after jQuery was first introduced.
00:00:12And it might surprise you to learn that jQuery is still pretty important. 88% of all websites
00:00:17still use it, thanks mostly probably to WordPress, but you can also see there's still some pretty
00:00:21big names that are running it too. I mean, if it ain't broke, don't fix it.
00:00:25Except this update might actually break some things, as they've used this one to make
00:00:29all of the breaking changes they've wanted to make for years, including trimming legacy
00:00:32code, removing deprecated APIs and never documented functions, and just a whole host of bug fixes.
00:00:38So let's just dive right in, take a look at the key changes, and just how far jQuery
00:00:42has come in 20 years.
00:00:49For the first big change, pull one out for Internet Explorer 10 and below. Support for
00:00:53this has now been dropped, but don't panic if you're watching this on Internet Explorer
00:00:5811. Support for that won't be dropped until jQuery 5, so you still have some time to hit
00:01:02that subscribe button. Alongside this, they also dropped support for Edge Legacy, iOS versions
00:01:07earlier than the last 3, Firefox versions earlier than the last 2, and also Android browser.
00:01:12So you can see we are really modernising now. In fact, the next 3 changes are all about that.
00:01:17So moving on to change number 2, they're migrating the jQuery source code from AMD to ES modules,
00:01:22so it should now play nicely with V, Webpack and modern build systems with no tricks required.
00:01:27So why not give it a go and install it in your next project, just for a little bit of
00:01:31fun or maybe for some nostalgia.
00:01:33And talking of nostalgia, this update will actually show you just how far JavaScript
00:01:36has come, because for change number 3, they've removed a bunch of jQuery functions because
00:01:41JavaScript has just caught up. They include things like isArray, passJSON, trim, now,
00:01:46isNumeric, isFunction, and loads loads more. You can now do pretty much all of these in
00:01:51JavaScript itself without the need for an additional library. I mean, it's kind of crazy that we
00:01:56need an additional library to do some of these in the first place, but that's the way that
00:02:00languages have to evolve.
00:02:01And talking of evolving, browsers also evolve as well. So for change number 4, the last big
00:02:06one of the modernization updates, they finally fixed focus order. If you didn't know, for
00:02:11years browsers didn't actually agree on an order of focus and blur events, so jQuery had
00:02:15its own definition so it would be consistent across all of them. But now, since they're
00:02:20deprecating the old browsers, all supported browsers, except Internet Explorer, have the
00:02:24exact same order, so jQuery is no longer going to override the native behaviour.
00:02:29You can really see the team focused on making jQuery modern here, as much of what made jQuery
00:02:34useful in the past has just been added to JavaScript eventually anyways. But there are
00:02:38still a few things in jQuery that can be modernized, like that of furs and callbacks which can be
00:02:42replaced with promises unless you're an Internet Explorer 11, or there's some animations that
00:02:47people do with jQuery that are now pretty easy to do in CSS. So if you do want to take it
00:02:52one step further, they've actually made that slim build strip out a load of these extra
00:02:55modules making it just 19.5 kilobytes, and I actually think this is quite a good approach
00:03:01to still offer those functions in the full package for those that might need them, but
00:03:04then offer a slim build that doesn't have any of the extras that are unneeded these days.
00:03:08So that's it for the key headline changes, but obviously there's been a ton of bug fixes
00:03:12and minor tweaks, some of them dating back years. The oldest I could find was from 2014,
00:03:17and related to jQuery auto promoting JSON to JSONP, which has now been fixed. And there's
00:03:22even an issue from 2015, which I actually remember running into where jQuery CSS setter would
00:03:28automatically append pixels to any number that didn't specify a unit. This too has now been
00:03:33fixed. There's loads more that you can go and explore yourself in there. There's even some
00:03:37casual fixes like fixing typos. But obviously, these will take a while to cover in this video.
00:03:42And personally, I just wanted to take a look at jQuery, see how far it's come as it's such
00:03:46an awesome piece of web development history. And perhaps it's even rude to say history
00:03:51when it's still so actively used and maintained. Now, obviously, I wouldn't go and use jQuery
00:03:56today instead of react or whatever modern framework, but it just serves as a reminder that the web
00:04:01is built on layers of technology. And sometimes the boring, simple and old tools are actually
00:04:06the ones holding the web together, especially those important legacy apps that no one dares
00:04:10to update. So I'm curious to those of you still here, did you use jQuery or do you still use
00:04:15it? Let me know in the comments below while you're there, subscribe. And as always, see
00:04:19you in the next one.

Key Takeaway

jQuery 4.0 is a massive modernization effort that sheds legacy browser support and redundant functions to remain a relevant, lightweight tool for the modern web ecosystem.

Highlights

jQuery remains a titan of the web

Timeline

Introduction and the State of jQuery

The speaker introduces the long-awaited release of jQuery 4, which has been in beta for two years and arrives two decades after the library's debut. Despite the rise of modern frameworks, a staggering 88% of websites still utilize jQuery, largely due to the massive footprint of the WordPress ecosystem. The narrator notes that while the mantra "if it ain't broke, don't fix it" applies to many users, this update is specifically designed to address long-standing technical debt. This section highlights that the update includes the removal of deprecated APIs and never-documented functions to streamline the library for the future. It sets the stage for a deep dive into how the library is evolving to stay useful in a changing development landscape.

Modernizing Browser Support and Build Systems

This segment focuses on the major shift in browser compatibility, specifically the official end of support for Internet Explorer 10 and below. Interestingly, Internet Explorer 11 is still supported for now, though its removal is already planned for the future jQuery 5 release. The update also drops support for older versions of Edge, iOS, Firefox, and the legacy Android browser to reduce code bloat. A significant technical improvement is the migration of the source code from AMD to ES modules, which allows for better integration with modern bundlers. This change ensures that developers using Vite or Webpack can now incorporate jQuery into their projects without the need for complex workarounds or "tricks."

JavaScript Convergence and Native Parity

The speaker explains how the evolution of native JavaScript has rendered several classic jQuery functions obsolete. Functions like isArray, passJSON, and trim have been removed because modern browser APIs now handle these tasks natively and efficiently. This section emphasizes that while these tools were essential in the past to normalize browser behavior, they are no longer necessary in a modern context. The removal of these functions is presented as a positive sign of language maturity rather than a loss of utility for the library itself. It reflects a broader trend of jQuery returning to its roots as a helper rather than a polyfill for missing language features.

Standardizing Event Order and the Slim Build

One of the more technical fixes involves the standardization of focus and blur event orders, which previously varied across different browsers. Since modern browsers have finally aligned on these behaviors, jQuery has removed its internal overrides to allow native behavior to take precedence. The video also introduces a highly optimized "slim build" that weighs in at only 19.5 kilobytes by removing animations and deferred modules. This modular approach allows developers to choose between the full package or a lightweight version that avoids duplicating features already available in CSS or Promises. This flexibility is seen as a strategic move to keep jQuery attractive for performance-conscious developers who still value its syntax.

Legacy Bug Fixes and Final Reflections

In the concluding section, the narrator details various bug fixes, some of which have been pending in the issue tracker since 2014. Key fixes include resolving an issue where JSON was automatically promoted to JSONP and stopping the CSS setter from automatically appending pixels to unitless numbers. The speaker reflects on jQuery's status as an "awesome piece of web development history" that remains vital for maintaining the web's infrastructure. While he admits he wouldn't choose jQuery over React for a brand-new project, he acknowledges its indispensable role in legacy applications. The video ends with a call to action for viewers to share their own experiences and history with the library.

Community Posts

No posts yet. Be the first to write about this video!

Write about this video