Live data from Hacker News

Gov.uk drops jQuery from their front end

web.dev

61–70 of 458 posts

Re: Gov.uk drops jQuery from their front end

#63
post #6

Eh. Everyone hates on jQuery, but for most informational sites that's really all you need for basic interaction. Speed really isn't bad, and it's so straightforward that it's hard to mis-use at this point. I seem to have way more issues with newer frameworks/SPA if I'm not using chrome with no extensions. Makes me nervous dealing with important stuff like banking or government sites.

For basic interaction, you don't need anything but vanilla JS. Browsers have come a long way since the days where jQuery was almost necessary to deal with all of the minor differences/bugs in various browsers.

[deleted]

Re: Gov.uk drops jQuery from their front end

#64
I've used jQuery at 2 of the 3 companies I worked for. It can take you very far. Frankly some of the critical features, like making selecting element easier/shorter, should have been ported into JavaScript long ago. I think jQuery is still around largely because it makes, otherwise vanilla, JavaScript easier to use.

Re: Gov.uk drops jQuery from their front end

#65
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

Re: Gov.uk drops jQuery from their front end

#66
post #47
post #24

Earlier quoted context omitted.

Collapsible section? https://developer.mozilla.org/en-US/docs/Web/HTML/Element/de... There's some CSS transition stuff you can add to that to make it lightly animated: https://css-tricks.com/how-to-animate-the-details-element/ Yeah, jQuery might make some things easier, but when possible, using native HTML elements makes things even easier,

Hmm, I would agree that you can do 95%+ of stuff jQuery used to be used for in vanilla js or html/css in a nicer way but animated collapsible divs still require a stupid amount of js to achieve.

[deleted]

Re: Gov.uk drops jQuery from their front end

#67
post #62

There's almost no point talking about javascript on HN with the amount of anti JS & anti framework rhetoric that happens here

There is also excessive praise for Gov UK design system that takes up half of the vertical space with cookie banner, flash messages, and navigation bar. It has so much useless negative space.

I would give it 5 marks out of 10. It’s decent but not a bastion of good design.

Re: Gov.uk drops jQuery from their front end

#68

I still use jQuery for frontend JavaScript when I can. It's so much more efficient than native JavaScript. I can't imagine anyone prefers to write document.getElementById('element').style.display = 'none' rather than $('#element').hide();

I would say jQuery has a place in any codebase that's simple enough it has imperative statements like that. Past a certain not-too-high level of complexity you're much better off writing "if (condition) then else null" in your view and "condition = false" in your update instead of even the short $('#element').hide();.

Re: Gov.uk drops jQuery from their front end

#69

I still use jQuery for frontend JavaScript when I can. It's so much more efficient than native JavaScript. I can't imagine anyone prefers to write document.getElementById('element').style.display = 'none' rather than $('#element').hide();

I prefer to write the first.

Re: Gov.uk drops jQuery from their front end

#70
post #53
post #6

Earlier quoted context omitted.

For basic interaction, you don't need anything but vanilla JS. Browsers have come a long way since the days where jQuery was almost necessary to deal with all of the minor differences/bugs in various browsers.

Right. However, jQuery isn't just for cross-browser. It provides a clean API for manipulating the DOM, as this site demonstrates (which is ironic): https://youmightnotneedjquery.com/ Personally, for simple sites, I aim for vanilla JS but use jQuery (cash, actually) where it makes sense - such as working on collections of elements.

for real its superior ergonomy is painfully obvious
Post reply on HN