Live data from Hacker News

Gov.uk drops jQuery from their front end

web.dev

151–160 of 458 posts

Re: Gov.uk drops jQuery from their front end

#151

Earlier quoted context omitted.

I never really knew jQuery besides the five things that I googled, so once I had to do more "dynamic" frontend things I just looked into Vanilla JS and it kind of works for me. Not sure if I had WTF-moments besides the normal "this seems to be how things work" stuff, so I think it's easy enough?!? Only thing I always have to look up is how to make sure my script is executed once everything is done and not before and…

Simplifying interaction with the DOM is obviously a huge feature of jQuery. But also the functions are just very nicely laid out with the assumption you are doing web stuff. $(thing).doThis() is just so perfectly terse and understandable for what it's doing. Not just writing, I find jQuery to be very, very easy to understand and read.

Yeah, you're right. Maybe I should give jQuery another look. :-)

Re: Gov.uk drops jQuery from their front end

#152

When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…

what's so wrong about sprinkling some jquery on a static website (generated with hugo or jekyll)?

On https://kubirds.com I use:

jQuery appear: https://plugins.jquery.com/appear/

jQuery fancybox: https://fancyapps.com/docs/ui/fancybox/

Do not put jQuery to the trash yet, it still have a long life ahead.

Re: Gov.uk drops jQuery from their front end

#153

I am all for dropping jQuery. But... Unless this team perfectly did a 1:1 replacement of jQuery calls with equivalent native JS functions, this isn't "removing a 30KB dependency reduced blocking time by 11%." It's "we rewrote our JS and it reduced blocking time"

There's only a small amount of JavaScript used on GOV.UK and everything degrades gracefully.

Re: Gov.uk drops jQuery from their front end

#154
post #94

Most developers don't seem to understand that jQuery was not just a wrapper for browser compatability. Yes, we do have all that nice functionality in a modern browser nowadays but compared to jQuery it just not as elegant. jQuery still has a place.

And that place is? Not saying I disagree, this just feels like an incomplete thought.

You are correct sir. I was trying to keep myself going on a rant. I think if you want to avoid large frameworks/build pipelines and the ugly mess that Web APIs are then jQuery fits perfectly. I have tried and failed many times writing vanilla JS for some smaller projects but always end up over budget and with code ending up looking like a worse version of jQuery. Only if you have large enough visitor count and team then using vanilla API makes practical sense because you might save couple GBs of web traffic and that is nice to see.

Re: Gov.uk drops jQuery from their front end

#155
post #54

Earlier quoted context omitted.

Even fetch?

Definitely not Fetch. I don't believe anyone can argue that Fetch is more complicated. I think this really seems to stem from a "I'm only used to jQuery, anything else is a big mental effort to learn and I'd rather stick with what I know". I get it. Vanilla JS, if you're not used to it, is scary. But if you're advocating for jQuery "for simple interactions", and assuming it's simpler than vanilla JS, at some point yo…

I mean `await $.ajax("https://jquery.com/")` is shorter than `await(await fetch("https://jquery.com/")).text()`

Re: Gov.uk drops jQuery from their front end

#156
post #78

Earlier quoted context omitted.

Maybe not design but I would say it is a bastion of usability.

I prefer USWDS for usability: https://designsystem.digital.gov/ Gov UK design system is poorly usable. From color use to disorganized, scattered layout; it’s put together with haste and not much thought. What it’s good at is looking sexy and minimal which captivates a lot of people.

While I haven't experienced USWDS deeply, that's kind of a problem in itself. A good design that doesn't get deployed is just that - a design. Gov.UK might not be pretty but it's consistent across different ministries, departments and instrumentalities which helps tremendously, but US government websites, even if restricted to the federal level, is a mess that I would prefer to hold my tongue at the inconsistency. What is GAO's plans to deploy them at least at a federal level? Is there even a plan? By the way, it's not solely Gov.UK which has this level of consistency (Singapore comes to my mind) so it's not a unique property.

Re: Gov.uk drops jQuery from their front end

#157

When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…

I agree with your sentiment in total, but I'd also add, for every out of touch programmer still swearing by JQuery, there are 5 recruiters that demand proficiency in it that other programmers feel they need to appease.

I think the most diplomatic way of distinguishing the two types of programmers is just to ask why they like JQuery.

"Because it helps me ship faster" may be a bit out of touch.

"Because it's a required competency in working with some code bases" are probably the latter.

Re: Gov.uk drops jQuery from their front end

#158

When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…

I wish JS would get all the nice jQuery features, like all the css selectors jQuery has, like a nice feature would be when you retive an HtmlElementCollection to be able to apply some transformation to all elements without having to write a for, or make use Array.from and then use forEach. But I agree I would not use jQuery in new project and when possible I would replace jQuery in existing code too.

That's what everyone keeps missing. Can vanilla do what jQuery can? Of course, and that has always been true. What jQuery (and similar) offer is quality of life stuff, vanilla has never even tried to offer.

This is still an ecosystem without a standard library and with no consistent design style/layout. It is janky and bad. It being "less bad than it used to be" isn't the shiny endorsement that everyone thinks it is.

Re: Gov.uk drops jQuery from their front end

#159

When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…

As a counterpoint, I had a similar conversation with a report of mine about jQuery. He said it was not necessary and you could just use vanilla js.

I said while yes that's true as a dev if I told you I needed you to implement a new payment provider for billing would you tightly and directly align with who we used or abstract it away via some wrapper so that if we ever had to change it wouldn't be difficult? Of course everyone builds abstractions so you aren't stuck with a single provider because it's crazy not to.

I see jQuery as that abstraction. At the end of the day each browser is an api implementer and while they've come so far, that doesn't mean the situation is stable and we'll never see implementation fracture again. It of course doesn't have to be jQuery but any direct implementation of JS seems to have that risk which is easily mitigated by wrapping the basic functionality. I don't know why you wouldn't choose to do it.

Re: Gov.uk drops jQuery from their front end

#160
post #145

Earlier quoted context omitted.

I think the more direct comparison is document.querySelector('#element').style.display = 'none' That has the same ergonomics as the jQuery selector, and is just a bit longer. I feel like with editors that autocomplete, it's not enough of a difference to warrant the extra dependency.

>That has the same ergonomics as the jQuery selector Nitpick: This crashes if #element doesn't exist, while the jQuery one does not. Also, the jQuery selector is a tiny bit more powerful (:even, :odd). IMHO, jQuery is good for what it's built for - a nicer interface than vanilla - but the main use case is much less needed now that frameworks exist.

The same power exists, again a bit longer, :nth-of-type(odd).
Post reply on HN