The Death of jQuery

People new to web development often turn to jQuery to help them learn to write interactive web pages. The story was no different for me. I have fond memories of using $(document).ready() as a new developer and finding a dollar sign about every ten lines of code.

For those unfamiliar with writing JavaScript code, the dollar sign ($) is how you access jQuery (fun fact: you can use it as both an object and a function) and eventually became synonymous with the library itself.

Currently, about 60% of all web sites (that are crawlable) are using the big $. But I’m going to make a prediction here that jQuery is on its way out. Here’s why…

History

We need look no further than jQuery’s history to understand how it became ubiquitous with web page development.

When jQuery debuted in 2006, it took the web development world by storm. Its popularity was largely due to the fact that it allowed front-end developers to write code that worked across all browsers. While this was primarily to fight Internet Explorer issues pre-IE9, it offered a fundamental shift in front-end development. jQuery also changed how we thought about web pages. Its view on DOM traversal and event handling changed how browsers were implemented and even pushed forward new technical specifications for HTML5 (think the Selectors API). In short, it changed the world.

But that was 2006

Today’s browsers conform to modern standards, meaning they provide a common set of functions, and thus taking away a bit of the initial “wow” factor from jQuery (IE still has its quirks, but they’re not deal breakers anymore).

jQuery is also fairly large, which is something that its development team is admittedly trying to address (they removed IE 6-8 compatibility in jQuery 2.0 in an effort to shrink file size). However, this improvement comes at the cost of one of the only reasons I would still use jQuery: backwards compatibility.

Additionally, today’s faster browsers and more tech savvy users negate the need to support incredibly old versions of browsers. Finally, almost all jQuery features are easily rewritable in a few lines of native JavasScript. This means there’s no reason to lug around that giant js file or force users to download it.

The Death Knell

If those reasons aren’t enough to sway you (they weren’t for me), consider how jQuery affects browser speed. Modern web pages perform upwards of thousands of complex interactions that provide users with a rich web experience. To do this, the browser has to be able to execute JavaScript pretty quickly, and while most modern engines are pretty fast, there’s no reason to overwork them. This is where jQuery falls short.

First and foremost, there is almost no reason for a full-fledged selector engine anymore because all modern browsers support document.querySelector/querySelectorAll. Not only do these functions have (almost) the exact same functionality, they execute drastically (upwards of 20-30%) faster. jQuery functions slow things down. It now makes more sense to just let the browser do what it knows how to do – it will always be faster.

jQuery, R. $. P.

I love jQuery because it launched me into front-end programming by dramatically lowering the barrier of entry. But sadly, its time has come and gone. In the ecosystem of the modern web, jQuery is bloated, old-fashioned and just plain ol’ slow. It will be remembered as one of the most fundamental and well-designed players of the last decade, and for that we are grateful.

One Reply to “The Death of jQuery”

  1. I bumped into this on LinkedIn, and it was actually very timely and helpful. Especially the part about document.querySelector.

    It’s good to be plugged into this group (not a sales pitch).

Leave a Reply

Your email address will not be published. Required fields are marked *