Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
We will always have to depend on jquery due to external shitty libraries you have to include or want to make profit of.
Long live jquery, unwanted. -
hjk10156964yjQuery still makes my code simple and readable. It just works in a lot of situations.
If you use it in your top heavy SPA than yeah you have a point don't make that shit s any heavier/slower.
And don't give me the you can use vanilla js. Just look at the all the migrating to vanilla tutorials. Everything is takes twice the amount of code. -
Oh come on, it's a crappy clickbait title to try to draw people in. I see more "X is dead" articles than I can count every year.
-
@hjk101 That's nonsense. I removed jQuery from a JS based widget some years ago so that I have the before/after stats on the application part.
Before: 30.8k, 24.9k without indentation, 15.2k minified. Plus 85k jQuery minified.
After: 35.3k, 28.8k without indentation, 16.6k minified.
Not even the application part doubled in size! Discounting the indentation since the editor does that by itself, it's 15.6% more source text. jQuery itself is gone not only in size, but it doesn't have to be parsed, either. Compared to vanilla JS, jQuery's performance is just horrible.
jQuery did have a point in the bad old days of IE6, and it also helped getting functions into vanilla JS - but current jQuery doesn't support old IE anyway, and it's just pointless. -
hjk10156964y@Fast-Nop I was of course taking about code readability and maintainability. The article that the OP posted contains ab link "that shows its not so challenging to use vanilla js" https://gist.github.com/joyrexus/...
As you can see everything is uglier and more code.
As I use a popular CDN the jQuery code rarely has to be fetched and even with jQuery my pages stay well below 150kb (yes that includes images). So on those pages I value clarity over purity.
I've also done a performance test because I've of those crappy hippy articles where clamming how horribly bad jQuery performed (like more than 10 times slower). It had the CTO convinced until I pointed out the jQuery methods where all just way different and crap. I got two examples faster in jQuery (still less and clear code) rest was slower in jQuery but negligible. -
@hjk101 The example uses XHR instead of fetch, Array.forEach instead of NodeList.forEach which is perfectly standard and fucking executes JSONP from an API.
It looks like it was written specifically to make fun of vanilla JS. -
@Fast-Nop If your webpage is 30k, you shouldn't be locating nodes by global queries anyway unless 3/4 of that text is comments because queries erase the relation between pieces of code operating on the same node and thus harm readability.
-
@hjk101 JQuery's method of Dom building incentivises string concatenation. I have yet to see a JQuery website that isn't vulnerable to at least one type of JS injection.
-
@Fast-Nop Nevermind I read 30k lines for some reason.
Still, big websites shouldn't use queries for javascript unless their documentation is in prime condition. -
@hjk101 Animations are particularly bad in jQuery. They were so bad that they earned JS based animations a bad name - undeservedly so. Though CSS based animations are the easiest way if not too complex.
But even something as simple as getting an element ID and changing the inner text is more than twice as fast in vanilla JS.
Also, I hope you are at least using subresource integrity via content security policy when fetching jQuery from somewhere else. That leaves "only" the increased brittleness due to the additional point of failure since your website won't work if the other site has a problem. -
@homo-lorens Yeah for complex stuff, direct DOM manipulation has fallen out of use for a reason, that being the typical jQuery spaghetti because the approach just doesn't scale well. But for simpler things, the additional overhead is considerable.
What I also hate about jQuery is how its own jQuery objects sprawl through the code like cancer. Ripping that crap out when going vanilla JS is the main headache. -
@jmau111 The latter... of course you are a fucker. We all are, that's devRant. Unless we're assholes, that's also fine.
-
@jmau111 As for the actual point - jQuery has been walking dead for years. Of course you don't rip it out of existing commercial legacy shit because that won't provide proper ROI, but using it for new stuff is quite a WTF.
-
There is no need for Jquery anymore. Use vanila JS, just build helper functions where needed.
If you insist on jquery syntax, there are minimal modern libraries implementing parts, do you research.
Related Rants
What's this fucker saying?
https://dev.to/jmau111/...
rant
jquery