5 comments

[ 3.5 ms ] story [ 21.3 ms ] thread
I don't see the point of using this. Can you please elaborate?
Seems to just be just shorthand for querySelector / querySelectorAll for those that like the jQuery style syntax. And then the ability to use forEach and map on NodeList elements.

It's a neat little snippet for those that want that, but other than that, makes really no difference.

It's as MarkCole said, just introducing a shorthand. So, there really is no point to using this.
There's a point to using this: it's a nice little convenience that a lot of people like about jQuery's style that requires no dependencies, can be copied & pasted without introducing a blob of possibly fragile code, and should have basically zero impact on performance. Try thinking of it as an idiom instead of a library. If you honestly think that all syntax that can be described as shorthand has no point you're missing a lot of expressiveness. That attitude tends to lead to littering code with the kind of laboriously spelled out replacements for the standard library that someone new to a language is prone to.

Is your background mainly Java or perhaps K&R-era C? I can understand how coming from that you might not be used to the little convenient tweaks you can make to a more dynamic language.

Yep, it's just shorthand. It's something I've been using in some projects recently as an alternative to something like jQuery, so I thought it would be useful in some sense to share it!

I guess this is just stemming from my view that a huge library like jQuery isn't necessarily needed anymore, now that most browsers support things like a good native API for DOM manipulation and traversal.