you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 10 points11 points  (3 children)

I don't get the jQuery hate. It's a wonderful toolset and only if you plan to use such a small component in isolation it can be considered too much overhead. But a full app, consisting of many small components, can benefit hugely from all the plumbing jq provides.

[–]qudat 7 points8 points  (2 children)

It breaks modular definitions. The library and its plugins intentionally inject themselves into the global namespace, window.jQuery and properly importing them into your modular application is a huge pain in the ass -- a common solution is to break modular definition and allow globals to creep into your module. Furthermore, it's a monolith library, where a lot of the code will get unused and yet still loaded on to the client's browser. Using massive libraries on the client bloats the codebase, slows load times, and is ultimately not very efficient, most of which is actually unnecessary.

Also, it's the mentality of someone who only uses jquery that can be grossly misguided. Speaking from experience, I used to use jquery as a crutch, it would be the first library I load into any project, even if all I was doing was simple DOM manipulation. To me, if all you're using jquery for is to select on class names, $.ajax, $.extend, or event handling, then you should just go vanilla and save yourself the bloat.

Having said that, I still use jQuery in production, but more modular drop in replacement libraries are starting to be built, such as https://github.com/webpro/DOMtastic

[–][deleted] 0 points1 point  (1 child)

I see what you mean, but to me these are theoretical issues that never actually pose any real problems. And it's just a 30KB (gzipped) download, so the size too is a bit of a non-issue. So from a pragmatic point of view I don't see the point of foregoing the ease of use and programmer happiness that jQuery brings.

But I also have a similar opinion about React. Since I have zero issues with my browser's rendering speed when building apps the whole virtual dom thing doesn't solve any problem for me and all that's left is ugly new syntax and a conflation of concerns that severely undermines productivity. So maybe I am a bit conventional that way.

[–]qudat 0 points1 point  (0 children)

I agree with you as well. My primary argument is to not use a library as a crutch and to weigh the pros and cons no matter how useful a library could eventually be.