Live data from Hacker News

How and why we removed jQuery from Gov.uk

insidegovuk.blog.gov.uk

21–30 of 45 posts

Re: How and why we removed jQuery from Gov.uk

#22
For anyone thinking that this is an insignificant saving of "only" 32kb, it's really important to remember that many of the site's users will be amongst the poorest in society. Many of them will be accessing it using the oldest, slowest devices; things far slower than the average HN reader's last few phones. Anything that can be done make the site work better for them is worth the effort.

Terence Eden has a really good blog post about just this topic: https://shkspr.mobi/blog/2021/01/the-unreasonable-effectiven...

Re: How and why we removed jQuery from Gov.uk

#23
Yes but how much the js-code parts grew because longer scripts length in vanilla javascript? And how much added for another ajax library? I don't see that using vanilla js instead of jquery gives enough advantage compared to that i have a much more pain writing that frontend code with vanilla. And specially replacing ajax or get (fetching json) with error handling (no server at all, server error, data not found -cases) is just awful with axios for example.

Re: How and why we removed jQuery from Gov.uk

#24

This team is really something when it comes to transparency. For a government entity, an unreasonably large amount of their work is on GitHub. Examples: Front end design system: https://github.com/alphagov/govuk-frontend Project board: https://github.com/orgs/alphagov/projects/4 Requests for comment: https://github.com/alphagov/govuk-rfcs Gov.uk infrastructure as code (WIP): https://github.com/alphagov/govuk-infrastr…

>For a government entity, an unreasonably large amount of their work is on GitHub.

Perhaps GitHub shouldn't be the venue, but I think you have that backwards. Most government entities share unreasonably little of their code.

Re: How and why we removed jQuery from Gov.uk

#25
post #8

Earlier quoted context omitted.

this is a bit pedantic I think it is okay to say "tax dollars" in general. I don't think you would generally expect people to say "tax euros" or "tax pounds" or "tax yen"

“Tax money” could work?

"Tax-payers' money" is often used in the UK as an equivalent

Re: How and why we removed jQuery from Gov.uk

#26
This article is an excellent “how to” recipe for going about this sort of refactoring, from the importance of training and of getting the backend folks on side, to clever use of attrition (no more jquery in new, then start removing it from old), and identifying sites that still needed it and accommodating them.

Seems like a well managed project.

(Yes, yes, this could be a very glossed over account that ignores frictions and factions along the way, but I quite enjoy taking it at face value.)

Re: How and why we removed jQuery from Gov.uk

#27

Yes but how much the js-code parts grew because longer scripts length in vanilla javascript? And how much added for another ajax library? I don't see that using vanilla js instead of jquery gives enough advantage compared to that i have a much more pain writing that frontend code with vanilla. And specially replacing ajax or get (fetching json) with error handling (no server at all, server error, data not found -case…

You don't need 32kb of code to use Fetch with error handling — especially since modern JS is not only faster but more concise than the style you would have written with jQuery in its heyday. I've gotten tons of use out of jQuery but it's been 15 years and browsers have gotten a lot better.

Re: How and why we removed jQuery from Gov.uk

#28
post #27

Yes but how much the js-code parts grew because longer scripts length in vanilla javascript? And how much added for another ajax library? I don't see that using vanilla js instead of jquery gives enough advantage compared to that i have a much more pain writing that frontend code with vanilla. And specially replacing ajax or get (fetching json) with error handling (no server at all, server error, data not found -case…

You don't need 32kb of code to use Fetch with error handling — especially since modern JS is not only faster but more concise than the style you would have written with jQuery in its heyday. I've gotten tons of use out of jQuery but it's been 15 years and browsers have gotten a lot better.

Especially when you’re writing progressively enhanced JS and the site falls back to something sane if it’s not supported.

Re: How and why we removed jQuery from Gov.uk

#29

If 32K is going to degrade your internet experience then you have more problems than just jQuery

This statement has already been made - and rebutted - twice in the top level of comments.

My point is that a phone browser that noticeably slows down for 32k is probably fairly useless. Why not get poor people better phones instead of spending money optimizing for crap?

Re: How and why we removed jQuery from Gov.uk

#30

Earlier quoted context omitted.

This statement has already been made - and rebutted - twice in the top level of comments.

My point is that a phone browser that noticeably slows down for 32k is probably fairly useless. Why not get poor people better phones instead of spending money optimizing for crap?

are you the one going to buy everyone in UK a new phone?

and fund their data plans?

Post reply on HN