4 ms·
You Don't Need JQuery
- shdon 11y agoWhile I agree that jQuery is often overused and not needed for basic DOM manipulation, what this document succeeds at most is reminding me just how useful the library actually is. [].slice.call(document.querySelectorAll(selector) || []); is not exactly intuitive and an awful lot of typing. That goes for quite a few of the examples given. Anybody who needs to do those things frequently ends up writing wrapper functions and basically reimplementing jQuery. Then there is the convenience and power of the monad syntax. Also that jQuery allows you to manipulate all elements matching a selector in a single statement, just as if it was a single element. And last, but certainly not least, the fact that it abstracts away quite a few incompatibilities and implementation details (classList is not always available, textContent behaves differently, etc. No, you don't need jQuery, but it does make life an awful lot easier.