4 ms·
With browsers having much better support with DOM selection, why would anyone be using jQuery in 2024? Not trying to throw shade, I actually think it's cool tha
by OccamsMirror 3y ago
With browsers having much better support with DOM selection, why would anyone be using jQuery in 2024? Not trying to throw shade, I actually think it's cool that it's still being worked on. But I'm confused as to what the use case is.
- anamexis 3y agoIf I had to guess, a convenient API and a massive ecosystem.
- arp242 3y agoThere's a bunch of pretty convenient selectors that are not supported by document.querySelector(), such as :selected, :checked and a bunch of others (I forgot which exactly, but I've run in to it a few times). In general the DOM API offends pretty much every single of my sensibilities on how to design good APIs. I also have some gripes with the jQuery API, but it's a lot better. jQuery just reads and writes so much more fluently.
- evan_ 3y ago`:visible` and `:hidden` are really cool
- senfiaj 3y agoIn my opinion selecting something based on it's layout is oftentimes a dangerous pattern, you are basically tying the UI layout with the logic. People can overuse these cool selectors. I've personally worked on a website where the frontend part was a spaghetti mess with the half of the source code occupied by selector names. Some files have over 5000 lines of code. It would be far less pain to maintain and implement features if the website used some framework like angular.
- mkl 3y ago:checked is standard CSS, and old.
- arp242 3y agoEh, do'h, of course. There's a few selectors anyway, but I'd have to check which ones exactly. :eq(n) and :visible from a quick check (:nth-child(n) can replace :eq(n) in some cases, but not all).
- mkl 3y agoYes, I've used :nth-of-type(n) for that too. Visibility is surprisingly messy though.
- niutech 3y ago:contains(text) is useful.
- sibit 3y agoLegacy projects? I maintain an old .NET web app that's ~15 years old and runs on jQuery. While the dream of refactoring or rewriting the entire thing using something more modern (like Web Components) is nice we're never gonna do it.
- rubymancer 3y agoI love it for admin pages. If only 20 internals are ever going to see it, jquery is as light as can be, can be loaded right from a CDN, needs no kind of transpilation and handles basically all you need.
- lcnPylGDnU4H9OF 3y ago> admin pages > CDN There’s a sysadmin just got called in for a security incident. Best to include it as a vendor library.