What is jQuery?
jQuery is a JavaScript library that was born in 2006. At that time, as unbelievable as it may sound, IE6 was the most popular browser! With the motto “Write Less, Do More”, jQuery’s goal was to unify the fairly broken, sparse and inconsistent DOM and AJAX native API implementations in the browsers. Because it brought an incredibly elegant solution to a terribly annoying problem, jQuery quickly became the most popular JavaScript with 65% of the top 10 million highest-trafficked sites still using it today.
Thus, jQuery has since its inception been a de facto companion on every client-side JavaScript project. It is undeniable that the level of abstraction and consistency jQuery brought to client-side web development has enormously helped building even better websites. And yet it seems like its glory is shredding out as more and more voices are asking for the complete annihilation of this pioneering library.
Is it time to go naked?
jQuery has been around for more than 9 years, and that is pretty much an eternity in client-side web development! During those years, the browsers have gotten a lot better at implementing the standards (most notably Internet Explorer) and the specifications have been including some features from jQuery (even if it is sometimes a bit clumsy, like querySelectorAll).
Thus, people will tell you that you might not need jQuery anymore, that jQuery is actually harmful! They will argue that jQuery solves problems that no longer exists. Some will even argue that jQuery is a brake on innovation! Some will even go further and tell you to free yourself from the chains of jQuery by embracing the native API!
Without being so dramatic, it is true that adding jQuery to your project will worsen performances because of the file fetching and the parsing of the code. It is true that in most cases, when there is a native alternative to a jQuery function, it is a lot faster. It is true that going naked today is a lot easier than a few years ago.
Why jQuery actually still makes sense today!
But it is also true that using jQuery will make you code faster and make your code relatively easier to maintain. It is also true that the jQuery API is a lot more readable than the native one in most cases (AJAX anyone?). It is also true that there are still some inconsistencies between browsers (jQuery still “solves up to 88 bugs across browsers). And it is also true that jQuery is still the best solution for backward browser compatibility.
And, after all, why not using a solid, reliable, broadly applicable and established library that allows you to write more readable code faster for a seemingly small performance penalty?