The jQuery hate is so stupid. jQuery is less than 30kb minified/gzipped and in most cases is loaded from a CDN, so considering how ubiquitous it is, it's probably already cached by the time someone comes to your site. So imo, the bloat argument is kinda dumb except in niche cases, mostly SPA. Yes, a typical project uses a small part of the library but is it any different with any other library/framework, including React ?
jQuery is a tool, unrivaled in it's time and like any other tool, it's better for some things and worse for others. You don't hate on a screwdriver because a power tool is newer and better. And sometimes a plain old screwdriver is just more practical and efficient in that instance.
Understanding that something isn't required anymore is not the same thing as hating it. Everyone saying that anyone who removes jQuery "hates it" is ridiculous. I loved it, I called it the thing that made Javascript not suck... almost 10 years ago. But, the world has moved on. Cross browser compatibility isn't a huge problem anymore and the extra things it added to your toolkit have almost all be incorporated into the DOM API and language itself. So why would you use it? The screwdriver analogy isn't accurate because our hands did not evolve to be screwdrivers, like the JS landscape has evolved to do the things jQuery did for us just as easily without it.
As a professional engineer you should be able to objectively reevaluate your toolkit from time to time. You should not be getting emotionally attached to your tools.
This. It’s not a screwdriver that was replaced by power tools; it’s a screwdriver that was replaced by screwdrivers getting built into everyone’s hands.
We should be grateful to it for leading that charge.
I consider jQuery obsolete and don't use it but I don't hate it.
jQuery did an awesome job demonstrating what Javascript was supposed to do, browser makers listened and now pretty much all that jQuery does works natively. Thanks jQuery.
I think the main point is that you don't need jQuery anymore, not that it's too bloated. JS and the native browser APIs have come a long way. Sure it's only 30kb, but it's 30kb that you do not need to include at all, because it can now all be done in vanilla JS.
Yeah, I wish jQuery was more modular. Like, if I could just borrow the DOM stuff and the selectors and not carry another implementation of promises with me...
And if you still have to support those browsers then by all means use jQuery! The point is that, moving forward and for modern browsers, we don't need to so we shouldn't.
Chrome could do most of jQuery’s stuff, but cross-browser was a fucking nightmare without it.
Five years later and it’s a totally different story.
I like to think that moving on from jQuery is in this case a rare example of the framework’s SUCCESS. It showed its value so effectively that the underlying language developed equivalent capabilities and so now it’s not outdated but rather redundant.
Extremely few frameworks or libraries can say the same thing.
Honestly I just like using jquery for the shorthand JavaScript dom rendering, editing, and animating. I know I can do it all in vanilla JavaScript, but I’m also really lazy.
JQuery was also popular because it could do complex things easier than vanilla. Nowadays, compared to modern frameworks, the resulting code is archaic and generally pretty ugly and bloated because you're mangling the DOM instead of the data, which is the more common approach in new frameworks that take care of DOM manipulation behind the scenes.
While I agree with your point, there is another aspect to this.
You want to use bootstrap. Bootstrap depends on jQuery. You are now forced to include jQuery, which is in relative terms heavy, in your project. Only for bootstrap. Using jQuery is from Bootstrap 5 onwards a choice, not mandatory.
If you do anything B2B, you already know that a significant portion of your clients are stuck on ie11 or even ie10, especially in government, healthcare, financial institutions.
Your team knows jquery, your codebase uses it, and it works perfectly.
Even if it's 3.5mb, point them at that and tell them to use it in conjunction with their router. With tree shaking and code splitting, there's really no legitimate reason for over bloated bundles.
283
u/croshd Feb 13 '19 edited Feb 13 '19
The jQuery hate is so stupid. jQuery is less than 30kb minified/gzipped and in most cases is loaded from a CDN, so considering how ubiquitous it is, it's probably already cached by the time someone comes to your site. So imo, the bloat argument is kinda dumb except in niche cases, mostly SPA. Yes, a typical project uses a small part of the library but is it any different with any other library/framework, including React ?
jQuery is a tool, unrivaled in it's time and like any other tool, it's better for some things and worse for others. You don't hate on a screwdriver because a power tool is newer and better. And sometimes a plain old screwdriver is just more practical and efficient in that instance.