by tambourine_man · 3y ago · 0 comments
But if these guys are only now reaching Knockout, I still have to wait for them to catch up to Backbone.js, I guess.
Hell, even querying the DOM is still easier with jQuery.
DOM:
- few if any DOM methods work on an array of elements. Or even on a NodeList
- `querySelector`: returns null if not found, Element if found. Throws if there's a selector syntax exception.
So you have to wrap it in a try/catch and in a check against null when you need to use it
- `querySelectorAll`: returns NodeList, Throws if there's a selector syntax exception.
NodeList is not an array. It's so badly designed that even the .forEach method was only added to it two years after the method was introduced.
If you need anything but .forEach, it's better to call Array.from() on the result than deal with iterator shenanigans of it's sparse interface
But sure, "it has 98% and 10% extra", whatever that means.
And that's just two of the methods. Everything else is just as bad: 90s-era verbose imperative object-oriented API.
I find myself feeling this way a lot while writing front-end code.
While I am primarily a back-end developer by trade, I find myself working in Vue or React quite often just to get things done and regularly come to the realization that the majority of the reactivity in the projects I am working on is either unnecessary or so simple that it would be handled with less complexity as a line or two of jQuery.
It works but on longer projects where requirements can explode in complexity it becomes a problem. It really helps to have tools that can stay maintainable.
Just watch out for that dust, if you sneeze next to a 5 year old Node.js/React project, the whole thing falls apart.
https://w3techs.com/technologies/overview/javascript_library
So it’s either a strange distribution curve, with a bump in the neck and a colossal tail, or we’re trapped in a bubble and blinded by our own crazy reality distortion field.
As to number of developers, if a lot more of us are needed to write a tiny fraction of the pages, maybe that’s the symptom right there.