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.
It's a much nicer syntax and has a ton of useful helpers. Vanilla js for similar things just looks like someone has waved the ugly stick at it. There are sound arguments against jQuery but the "you can just use vanilla" is the least convincing.
Gov.uk drops jQuery from their front end
11–20 of 458 posts
Re: Gov.uk drops jQuery from their front end
#12I miss the days when jQuery reigned supreme, and all the tenderfoot magpie developers didn't yet have the twinkle of React in their eyes
Re: Gov.uk drops jQuery from their front end
#13Eh. 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.
I loved jquery back in the day. It made web development bearable in a time when it was a clusterfuck. I think a lot of people owe a lot of thanks to jquery. But in 2022 vanilla javascript is all you really need.
// jquery
$(selector).on('click', fn)
// vanilla js
document.querySelectorAll(selector).forEach(el =>
el.addEventListener('click', fn)
)Re: Gov.uk drops jQuery from their front end
#14While it may be nice, for large production apps we'll take the filesize gains where we can find them.
Re: Gov.uk drops jQuery from their front end
#15Eh. 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.
Re: Gov.uk drops jQuery from their front end
#16Earlier 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.
I'll admit I'm a bit out of practice with the state of vanilla JS, but it seems like you'll be re-inventing the wheel for simple stuff. Like a collapsible section that's lightly animated. I worry too about people not considering accessibility. A lot of my bugs day to day is not being able to tab into things like hover menus or being able to activate buttons because someone forgot to consider correct event callbacks.…
Re: Gov.uk drops jQuery from their front end
#17Earlier quoted context omitted.
It's a much nicer syntax and has a ton of useful helpers. Vanilla js for similar things just looks like someone has waved the ugly stick at it. There are sound arguments against jQuery but the "you can just use vanilla" is the least convincing.
Not having to load yet another JS library on your page if you don't really need it is a pretty good argument, I'd say.
Re: Gov.uk drops jQuery from their front end
#18Still good to remove unncessary dependencies, though.
Re: Gov.uk drops jQuery from their front end
#19Earlier quoted context omitted.
It's a much nicer syntax and has a ton of useful helpers. Vanilla js for similar things just looks like someone has waved the ugly stick at it. There are sound arguments against jQuery but the "you can just use vanilla" is the least convincing.
Not having to load yet another JS library on your page if you don't really need it is a pretty good argument, I'd say.
Even GOV.UK, an incredibly lean website by today's standards, only noticed a 10% difference in their benchmarks.
Re: Gov.uk drops jQuery from their front end
#20Earlier quoted context omitted.
I loved jquery back in the day. It made web development bearable in a time when it was a clusterfuck. I think a lot of people owe a lot of thanks to jquery. But in 2022 vanilla javascript is all you really need.
jQuery still offers a much nicer experience. The built-in dom apis are neither very elegant nor ergonomic. // jquery $(selector).on('click', fn) // vanilla js document.querySelectorAll(selector).forEach(el => el.addEventListener('click', fn) )
Having said that, for the sake of 25kb - if you use more than a handful of features you might as well just include it.