Live data from Hacker News

Gov.uk drops jQuery from their front end

web.dev

121–130 of 458 posts

Re: Gov.uk drops jQuery from their front end

#122
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"

Re: Gov.uk drops jQuery from their front end

#123

Earlier quoted context omitted.

I don't think so. One trick I've used to good effect is setting an high max-height, then translating by 100% and removing pointer events.

I feel like this solution feels subtly "wrong" if you're animating, because that high max height will be arbitrarily far away from where you'd normally want to animate to. Doubly so for easing out.

Yeah it's a bit weird, but haven't found a better trick yet.

Re: Gov.uk drops jQuery from their front end

#124
post #116

Earlier quoted context omitted.

Oh god, Backbone. I absolutely hated that framework. It didn't even seem to do anything, it seemed like I had to implement all of the logic myself. Except I had to do it their way, for some reason, and practically nothing made sense. (I haven't touched it in years, though, so my memory is probably distorting my experience) I like the idea of React, just not what it has turned into. The amount of tooling that it has c…

Re: React, have you looked at Vanilla custom elements: https://javascript.info/custom-elements I've been using them lately and I think they are the bees knees.

Yeah I have been looking them over and they seem very interesting. Have not tried them yet.

Would love for there to be One True Way(tm) without the framework question.

Re: Gov.uk drops jQuery from their front end

#125
post #27

Tangential, but sometimes I see people say that jQuery is dead/failed. While it's not as popular anymore, I think that's actually the perfect evolution for it. jQuery was making up for browser API shortcomings, and now many of those shortcomings have been addressed and been incorporated into browser APIs (not everything, but quite a bit).

I really don't get this discourse, jQuery API is much more ergonomic, concise and clearer than the DOM api. Sure you can do it but that doesn't mean you should

[deleted]

Re: Gov.uk drops jQuery from their front end

#126
post #111

Earlier quoted context omitted.

Just replace that one liner with a 15 liner.

document.querySelector('html') And for React: https://javascript.info/custom-elements

It's not because you know how to do a hello world that you know how to program.

Re: Gov.uk drops jQuery from their front end

#127

Earlier quoted context omitted.

> jQuery was making up for browser API shortcomings While this is true, I can still code circles around frontend developers using vanilla JS. The decline of jQuery is mostly due to the rise of webapp frameworks like React and Vue. But if you are tasked with adding like, a button to a static webpage, jQuery is still the king.

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.

Re: Gov.uk drops jQuery from their front end

#128
post #27

Tangential, but sometimes I see people say that jQuery is dead/failed. While it's not as popular anymore, I think that's actually the perfect evolution for it. jQuery was making up for browser API shortcomings, and now many of those shortcomings have been addressed and been incorporated into browser APIs (not everything, but quite a bit).

> jQuery was making up for browser API shortcomings While this is true, I can still code circles around frontend developers using vanilla JS. The decline of jQuery is mostly due to the rise of webapp frameworks like React and Vue. But if you are tasked with adding like, a button to a static webpage, jQuery is still the king.

>While this is true, I can still code circles around frontend developers using vanilla JS.

My first use of jQuery was in the dark days was building UIs (with things like drag and drop, etc) that had to run on Internet Explorer and Netscape. We'd started with "vanilla" but were ending up with what was effectively two separate codebases. Moving over to jQuery let us eliminate a massive amount of duplicate code and dramatically increased our productivity.

Re: Gov.uk drops jQuery from their front end

#129
This article says makes 2 competing claims

A) jquery deals with inconsistent browser implementations, largely in older browsers

B) replacing it with modern API calls made the website more usable for all users including those on older machines (and presumably OS’s)

I don’t see how to square those.

Re: Gov.uk drops jQuery from their front end

#130
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…

As someone kinda obsessed with handcrafting all of its software without any dependency and is highly used to dom operations, I can't but thing you're making it much more of a deal than it is.

Handcrafting JavaScript applications without jQuery is possible, the real question though is: is it convenient if you like and find productive using jQuery? Here's a fact: you can always remove jQuery later when the product is mature and standards understood and there is time budget for it.

Post reply on HN