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.
document.getElementById(‘myelement’) vs $(‘#myelement’)
There's also document.querySelector('#element') if we're not fussed about very old browsers. I personally find the syntax much nicer because you can use it in the same way you would with the jQuery selector - I can pass a string and not worry if it's an ID or a class.
I know that's probably sarcasm, but honestly that's probably the main reason I still use jQuery here and there. When dealing with something that is thousands of lines long, all of the extra characters really add up. (i.e. I'm lazy.) At this point my company has so many legacy sites built with it. Rewriting all of it "the long way" is just too daunting of a task with so many other projects in the pipeline. One day I'll probably get around to it, but right now I still love the brevity of the jquery language.
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.
It technically could be done, but it was a gargantuan, insane task without jQuery (obviously, this depends on the complexity of a given task, but I'm talking about serious apps of the day).
In 2019 (hell, in 2009), jQuery is largely unnecessary because all it really does for you is obfuscate the DOM API without any discernible benefit.
166
u/[deleted] Feb 13 '19
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.