News for hackers. Stuff that matters.
Re:jQuery 3.6.0 by vbezhenar on Tuesday March 02, 2021 @02:50PM (#26319663)
Your example does not work. querySelectorAll returns array and you can't write `array.classList.add("...")`, because array does not have that property. You need to iterate over that array. And that's exactly why jQuery is so much more convenient over native API: you can just treat collections of elements like an element and jQuery will iterate for you if necessary.

Another jQuery advantage is pseudo-selectors which don't exist in CSS.

There are plenty of convenient one-liners in jQuery which will expand to plenty of lines in native API. That said, with modern API and JS features it's not that bad either.

Re:jQuery 3.6.0 by t_tsonev on Tuesday March 02, 2021 @03:07PM (#26319892)
Just a nitpick, but querySelectorAll returns a NodeList.

This can bite at times, for example IE supports Array.forEach, but not NodeList.forEach

Re:jQuery 3.6.0 by dceddia on Tuesday March 02, 2021 @03:19PM (#26320055)
Yeah this gets me every time. You can .forEach a NodeList, but can't .map. I usually end up wrapping it in an array and calling map on it like [...theNodeList].map(...)
Re:jQuery 3.6.0 by mkl on Tuesday March 02, 2021 @03:06PM (#26319883)
querySelectorAll returns a NodeList, which is even more limited than an array (e.g. no map or filter).
Re:jQuery 3.6.0 by ROARosen on Tuesday March 02, 2021 @03:24PM (#26320134)
but [...querySelectorAll()] does return an array and is just as concise
Re:jQuery 3.6.0 by lhorie on Tuesday March 02, 2021 @04:05PM (#26320724)
but beware of ASI :)