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.