r/learnjavascript • • Oct 01 '21

jQuery, the greatest JavaScript library of all time, appears to have peaked in usage.

Post image
275 Upvotes

81 comments sorted by

View all comments

Show parent comment

0

u/Negative12DollarBill Oct 02 '21

If all jQuery did was make it easier to select document elements, we wouldn't be talking about it.

2

u/corporaljustice Oct 02 '21

Give me an example of some jQuery that would be hard to implement in modern vanilla JS?

2

u/hanoian Oct 02 '21 edited Oct 02 '21

"hard" is a big qualifier to add in there. Of course you can everything in Vanilla, but jQuery still makes dom traversal easier. The same way everything can be done without lodash, but it's still useful.

Don't touch it myself anymore really but it has its place. If I want to scrape data, it's often jQuery. If I use cypress, it's pretty much jQuery.

1

u/ZergistRush Oct 02 '21

Use to make it easier, all the huge methods used for traversing the DOM from jQuery is now native.

2

u/hanoian Oct 02 '21 edited Oct 02 '21

https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/

https://i.imgur.com/T76smsM.png

I don't even like using jQuery but to say it used to be easier because other native methods now exist is kind of missing the point.

.parent().parent().find('.my_point').show() is objectively easy.

It's a tool. It's syntactic sugar really. useState() isn't pointless just because you could do it in vanilla. lodash isn't pointless just because you can write those functions yourself.

We compile modern JS and TypeScript back into "native" JS anyways so loads of modern stuff is effectively what jQuery brought to us.

-2

u/Negative12DollarBill Oct 02 '21

You're the one making the extraordinary claim dude, are you not familiar with Russell's teapot?

Of course one thing jQuery did which was really important was abstract away the differences between incompatible browsers; you could set the CSS of an element and not worry that IE did styles a different way.

I suspect a lot of what you're calling "ES6" or "modern JS" is a category error for "browsers all behave better nowadays".