Re:jQuery 4.1.0
by chuckadams on Tuesday November 17, 2026 @04:30PM
(#50538464)
jQuery collections are much much nicer than the incredibly anemic NodeList you get from querySelector, which doesn't even implement a full JS Array. You can set states on every element matching a jQuery selector as if it were a single element. I don't personally use jQuery very often since I prefer declarative components, but if I'm whipping up something imperative like a user script, it's hard to beat jQuery's "lenses for the DOM", as one Haskell programmer put it.
[ Parent
| on HN ]
> set states on every element matching a jQuery selector
Very much so. jQuery had 2 major selling points - (1) browser polyfills and (2) conciseness, as per their motto, "Write less, do more". It seems (2) has been largely forgotten since (1) has been rendered obsolete. Its idea of running functions on a collection often made scripts end up at one-third to one-half of the equivalent vanilla JS, which needs loops to do the same thing.
Love me some jQuery. I honestly think the web would be in a better place if we hadn't stopped using HS for things like little jQuery scripts and kept the servers doing the controllers and handling the models.
That's a lot of stuff just for [...nodeList].
Re:jQuery 4.1.0
by chuckadams on Tuesday November 17, 2026 @05:36PM
(#50539272)
jQuery predates that syntax, but have fun chaining that even now.
jQuery had a lot of reasons for existing. And now it has less than it used to. I believe that was the point.
You'd probably usually chain that inside the callback. Instead of addClass('foo').hide(), you'd do el.classList.add('foo'); el.hidden = true; or something. It's not 1:1, but also it's not really that big a deal.