Live data from Hacker News

Gov.uk drops jQuery from their front end

web.dev

161–170 of 458 posts

Re: Gov.uk drops jQuery from their front end

#161
post #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.

It's pretty expensive to ship and compute. Wikipedia for example dropped jquery from their navigation and it resulted in a ~27% difference in battery usage IIRC.

Re: Gov.uk drops jQuery from their front end

#162

We found it to be about 32kb gzip+minified in our builds. I just dropped it from one of our apps, where it wasn't even used except in a legacy logging module. We replaced the ajax call with XHR. The other app we maintain has it as well, again only for the ajax method. While it may be nice, for large production apps we'll take the filesize gains where we can find them.

I believe it's kind of sad that in the days of 2 TB USB sticks that 32kb matter.

Re: Gov.uk drops jQuery from their front end

#164

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…

What? Web APIs are one of the most stable APIs in existence. "Don't break the web" is taken very seriously.

Re: Gov.uk drops jQuery from their front end

#165

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"

Talking to developers sometimes feels like hitting the same wall when I talk to people about whether putting all of your money into a house is a sound investment strategy.

There's a lot of willful blindness about cost structures. If it were just one or two people you might conclude that folks are trying to sweep things under the rug, and when I was just starting out I did feel that way. But it's so consistent that I often end up bonding with people who don't feel that way, without putting Dunbar's Number into any sort of danger.

One of the hardest "Code smell" issues I've had to contend with is the habit of people to spread out problems so thin that you can no longer see them, because they're everywhere. Like being in a room with a bad smell, eventually you can't detect it without a major change of perspective. Even though everyone new who comes in starts with, "what is that smell?"

11% of your blocking time on a library could be a perfectly reasonable *budget*. The mistake is not having a goal, or assuming the goal is zero. Zero is dumb, because if that's your target then we'd be talking a static HTML page and then why are they paying you? So what's your real budget? And given that budget, what's a reasonable proportion for different concerns? 1/9th spent on a library is probably a bargain.

Re: Gov.uk drops jQuery from their front end

#166
post #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.

I checked out kubirds, and even though I'm probably somewhat in your target demographic, I noticed that I couldn't discover what kubirds does without watching a video.

Even scrolling down, and through the website, I didn't really understand it, until you compared to Nagios, which I am familiar with. Hope you don't mind a little unsolicited feedback. The website does look super clean!

I would love to read a paragraph of your elevator pitch the moment I lay my eyes on the site though. Cheers.

Re: Gov.uk drops jQuery from their front end

#167
post #146
post #93

Earlier quoted context omitted.

how's browser support for something like "a:has(img[src$='.gif'])" though?

:has doesn't exist but you can do [].map.call(document.querySelectorAll("a img[src$='.gif']"), (e)=>e.closest("a")).filter(e=>e)

:has certainly does exist, but only in Safari. Hopefully Chrome and Firefox will catch up soon.

Re: Gov.uk drops jQuery from their front end

#168

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…

The problem is that most of the "abstractions" provided by jQuery are no longer abstractions and can frequently be replaced with simple alternatives that are directly provided by browser APIs that have extremely wide support.

https://youmightnotneedjquery.com/ is a handy illustration of this.

Re: Gov.uk drops jQuery from their front end

#169

Earlier quoted context omitted.

Other functions are much more difficult to replace $('.sth').closest('ul') To me jQuery is like Regex or Linq. I think it had a really good api.

Is it harder or just a bit longer-winded? E.g. i'm thinking this is the same behaviour document.getElementsByClassName('sth')[0]?.closest('ul');

That's not exactly the same, I don't think, because jQuery will give you all the `ul` that are closest to `.sth`, not just the first. You'd have to write a loop over the list returned from `document.getElementsByClassName('sth')` to get the same behaviour (because it doesn't look like the standardised `closest` works on lists.)

Re: Gov.uk drops jQuery from their front end

#170
post #164

Earlier quoted context omitted.

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…

What? Web APIs are one of the most stable APIs in existence. "Don't break the web" is taken very seriously.

The context for this belief has only existed for about 10 years now.
Post reply on HN