I thought about giving this post the title “Why I hate jQuery” but aside from the actual piece of jQuery I actually hate, jQuery is a magnificent piece of code.
But why should we move away from it?
jQuery was invented at a time when web developers can’t do things. Cross-browser. But the times are different. Web browsers have evolved. Standards have evolved. jQuery is becoming more and more irrelevant.
On a backwards-compatibility note: sure, jQuery might still be relevant for those purposes, but sticking to the old ways may impact beginning and even expert web developers towards innovation.
Finally, here’s the list of the specifics:
- Sizzle, and by extension jQuery’s selectors, are deprecated by Document.querySelector and Document.querySelectorAll. Yes, we have those now. And they’re awesome.
- UI? If you ever need new controls, there’s Shadow DOM now.
- One thing I really hate about jQuery is their Promise system isn’t compatible with A+. This means I can’t return-and-ignore
thens from promises. For the record, ES6 will use A+-style promises. Oh man, this will really confuse people when they come from jQuery to ES6 promises.
- Animations? We have CSS3 animations now.
- Standards have taken care of the pain of adding and removing classes thanks to Element.classList.
- jQuery had supported for custom element data and added support for data attributes when they came but why not just use native?
- I don’t like how jQuery hides events in a wrapper.