GOV.UK Drops jQuery
Written by Ian Elliot   
Wednesday, 25 May 2022

jQuery used to be essential - now it's optional, or is it? The devs at GOV.UK have made a big fuss about finally getting rid of the evil code. But is dropping 32k of download worth it when you take everything into account?

I am a jQuery fan and have been for a long time, but I don't always use it when starting a new project. At the moment at least, I certainly don't think its worth re-engineering something to remove it from a working system.

Strangely there is a lot of prejudice about using jQuery because it has a long history. It is often said to be a "grey beard" choice, suggesting that old programmers just don't update their knowledge. Personally I think the situation is around the other way - younger programmers think they know what problem jQuery is supposed to solve when in fact they don't.

Let's take the GOV.UK programmer's reasons for getting rid of jQuery:

jquerytweet

So the motivation seemed to be getting rid of 32KB of unneeded download and increasing the speed of execution. These are hardly grounds for getting rid of jQuery. The data presented indicate that there are some speedups as a result of removing jQuery. The argument is that jQuery was invented to makeup for the lack of support for CSS selector syntax and, as modern browsers all support this, we no longer need jQuery - it can all be done in plain JavaScript.

This isn't quite true as jQuery has long been about ironing out the differences between browsers and providing a powerful toolkit of functions that get the job done more simply.  If you know jQuery then you can often find a natural implementation in fluent style that finds DOM objects, filters and changes them in one operation. It results in cleaner code and usually better code. Put simply, you don't just use jQuery to make up for browser deficiencies but for programmer deficiencies as well.

ukgov1

To remove jQuery just because querySelector and querySelectorAll are now supported just indicates that you haven't explored what jQuery actually gives you. It used to be called the standard library for JavaScript and it still has ways of working that are superior than just plain JS. If you are only using jQuery to do the work of CSS selects then you are guilty of not understanding what it offers. Keep in mind that jQuery's motto is "write less, do more" and it is still true.

Then there is the argument that GOV.UK's clients are not all going to be using top end machines and downloading 32K is a time waste if they are on a flaky slow connection. Really? This consideration doesn't stop the download of 50K of Google Analytics script or 60K in fonts! This really does seem like picking on a feature to remove just because it has fallen out of fashion. If the clients really are going to be connecting using old tech then communication speed isn't the only issue - old browser support is likely to be important. By removing jQuery and relying on what modern browsers provide native then GOV.UK has effectively disenfranchised the poor users they claim to be helping.

I'd like to see some metrics on how many clients are now having problems working with their web pages, not just a few figures showing me the obvious fact that dropping 32K of download means pages load a bit faster. But my guess is there are no such metrics.

Ah... it's all fashion and no logic.

jquery3

More Information

Twitter thread

Related Articles

GitHub Removes jQuery. Why?

jQuery 3.2.1 Is Out - Do We Still Care?

jQuery 3.0 Final Released

JQuery Ever More Popular

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


ZLUDA Ports CUDA Applications To AMD GPUs
18/04/2024

ZLUDA is a translation layer that lets you run unmodified CUDA applications with near-native performance on AMD GPUs. But it is walking a fine line with regards to legality.



Conference Times Ahead
29/03/2024

Following a well-established pattern both Google's and Microsoft's Developer Conferences will take place in May while Apple follows on in June. Here are the dates plus what to expect.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962501>

<ASIN:1871962528>

<ASIN:1871962579>

<ASIN:1871962625>

 

 

 

 

 

Last Updated ( Monday, 20 June 2022 )