Why we should stop using jQuery

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:

  1. Sizzle, and by extension jQuery’s selectors, are deprecated by Document.querySelector and Document.querySelectorAll. Yes, we have those now. And they’re awesome.
  2. UI? If you ever need new controls, there’s Shadow DOM now.
  3. 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.

Others:

  1. Animations? We have CSS3 animations now.
  2. Standards have taken care of the pain of adding and removing classes thanks to Element.classList.
  3. jQuery had supported for custom element data and added support for data attributes when they came but why not just use native?
  4. I don’t like how jQuery hides events in a wrapper.

At least some of these things came to mind because I’m still including jQuery in some of my projects because I need to have Bootstrap, but then why does Bootstrap still require jQuery, right. So what if we had our own pure Javascript/CSS responsive framework? What? Foundation?

Advertisements

One thought on “Why we should stop using jQuery

  1. Robert

    I hate jQuery for another reason. As a beginner learning JavaScript when I search for answers they always seem to be jQuery answers, and usually there’s a pure JS solution that’s just as good! I thought the point of a framework was to extend not replace! If I could reasonably make money doing anything but web development I would!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s