• What is the State of jQuery in 2021?
  • By Louis Petrik
  • Translation from: The Gold Project
  • This article is permalink: github.com/xitu/gold-m…
  • Translator: Badd
  • Proofread: Nia3y, ZavierTang

Will 2021 be a good year for jQuery?

Often, nostalgia is about old photos, old songs or old places. My nostalgia is that after all these years and all these projects, I’m still using jQuery. This JavaScript library has been around since 2006, making it older than React, Vue, or even Angular.js.

JQuery was once the dominant player in the JavaScript world. With it, we are much more comfortable developing dynamic Web applications. In particular, when manipulating the DOM and making network requests, jQuery is more straightforward to use.

So what’s the state of the classic JavaScript library? What’s new with it? Who still uses it? Is it popular or not? Here’s the answer.

So, what’s new with jQuery?

I did my homework: I went to the official jQuery blog for 2016 to see what had been updated.

The answer: to be honest, hardly at all. Sure, jQuery 3 brings a number of updates, but none of them are worth mentioning. None of the updates come close to the milestone that was the introduction of Hooks in React.js a few years ago.

A minor update is to support the use of for-of loops on jQuery objects. In the internal implementation, jQuery now also uses requestAnimationFrame() to run the animation.

Beyond that, there have been no major updates. The reason is simple: jQuery has evolved far enough to be useful.

Are there any other companies using jQuery?

Speaking of technology selection, industry manufacturers always play an important role in leading the trend. Once a technology is chosen by a group of developers with a voice, it gives that technology a lot of priority weight. Even though jQuery is on its way out, it’s still an important player on the Web.

Wappalyzer’s analysis shows that jQuery still accounts for more than 34% of all sites that use JavaScript libraries.

Of course, we’ll just have to look at this data — just because there are thousands of sites that still use jQuery doesn’t mean it’s the right choice. In addition, jQuery has become a necessary dependency for other libraries.

Bootstrap is where jQuery comes in. Until now, the CSS framework has been using jQuery for all DOM operations. It wasn’t until Bootstrap 5 that jQuery was disabled.

Now let’s take a look at how jQuery is being used by companies: Across the Internet, I find many companies claiming to be using jQuery. However, as the technology stack continues to be updated, we need to figure out where jQuery is being used.

In fact, Stack Overflow is still using jQuery. Other companies using jQuery include:

  • Wellsfargo.com
  • Microsoft.com
  • Salesforce.com

Yes, even Microsoft is one of them. But even then, the technology stack of these companies is not a complete reference. Even at big companies like these, their web developers may be misreferencing unnecessary libraries or not having the time to optimize.

If jQuery is dead, it’s not for the reasons we thought

I don’t like to use the word “dead” to describe technology. After all, the tech industry is not a hospital. But you do have to admit that jQuery isn’t as popular as it used to be, especially in the last five years:

But why? Many might think it’s because of the popularity of frameworks and libraries like React, Vue, and Angular. But that’s not really the reason. Those popular frameworks take a completely different route than jQuery. Yes, they both aim to make it easier to develop Web applications. But there are huge differences.

Those frameworks go the route of componenzation, data binding, state management, and single-page applications. JQuery, on the other hand, is a dialect of pure JavaScript, as you can see in the following example:

let el = document.getElementById('contents'); 

// jQuery:
let el = $('#contents');
Copy the code

Even frameworks like React, Vue, or Angular are not applicable everywhere. JQuery can still be very useful for sites that can be developed without a heavy-duty framework.

It’s not the framework that kills jQuery.

What kills jQuery is JavaScript itself.

The document.querySelector() function alone has turned many jQuery enthusiasts to native JavaScript. (I use jQuery a lot myself because of the very useful syntax of $().)

JavaScript has evolved to make it easier to access the DOM. Even web requests, which jQuery is good at, are becoming more intuitive and easy to use in JavaScript.

Maybe we miscalculated the impact of jQuery on performance

Needless to say, libraries don’t always have a positive impact on site performance. Especially when the library size is large, the site load time is also extended. But jQuery is only 30 KB, so it’s not cumbersome. Here’s a comparison between Vue, React.js and Angular’s compressed NPM packages:

  • vue22 KB:
  • react-dom + react41 KB:
  • angular: 62 KB

Note: This is just the size of the frame package. The production package for the entire application is even bigger! So when it comes to load times, jQuery does a pretty good job.

What about Render performance?

Large frames compete for the crown of best performance. The benchmark is usually a rendering of a large table, or thousands of status updates at once. In these kinds of experiments, the frameworks have been pulled apart — and native JavaScript has no problem beating them up.

But to be honest, these benchmarks usually don’t make much sense. This is especially true for sites that aren’t really “apps,” they’re just for displaying content, and the rendering capabilities of the library are empty. Users won’t even notice that a drop-down list uses a “slow rendering” library.

conclusion

I don’t believe that continuing with jQuery is a mistake. This library is still very helpful in many scenarios, especially if you can master it. Of course, modern JavaScript is worth giving it a try.

If you want to maximize the performance of your Web application, jQuery is not going to help. You can save that 30 KB of code and do everything in pure JavaScript without worrying about the lack of “philosophy” like reusable components or MVVMS.

JQuery has always been better suited to sites that focus on content rather than functionality. For more complex Web applications, the React philosophy of componentization is a great place to start.

Thanks for reading!

If you find any errors in the translation or other areas that need improvement, you are welcome to revise and PR the translation in the Gold Translation program, and you can also get corresponding bonus points. The permanent link to this article at the beginning of this article is the MarkDown link to this article on GitHub.


Diggings translation project is a community for translating quality Internet technical articles from diggings English sharing articles. The content covers the fields of Android, iOS, front end, back end, blockchain, products, design, artificial intelligence and so on. For more high-quality translations, please keep paying attention to The Translation Project, official weibo and zhihu column.