Do we still need jQuery to DOM-script web pages?
It?s not about the advent of Angular, React or Vue, it?s more a fact. Developers know that frontend programming has been evolved into something serious, very serious, and that?s why we need a modern JS framework like those I told before to better implement OOP, design patterns, performance improvements, code management and reusability, but it?s even deeper than that. I will explain, using key case studies, why jQuery is becoming useless day after day and will become nonsense in few months.
Photo by Jan Tinneberg on Unsplash
No way: jQuery is so popular
That?s true, absolutely true. jQuery is still today the top popular JS framework around and there are tons of web pages integrating it. Moreover, jQuery did increase its popularity due to its massive integration into WordPress themes and platforms like that, making it the undiscussed top Javascript framework ever. jQuery lasted for so much time, probably even more than 10 years and it just became popular year after year. That?s why every front-end developer will still work with jQuery stuff for at least a couple of year since its death. Anyway, even if it?s true that developers still use jQuery to code new features and to solve bug of actual web pages, we definitely need to switch to something ?necessary? more than ?old and necessary?! I know and meet developers still using Java 6, but it doesn?t mean that Java 6 isn?t useless to code new softwares.
No way: jQuery is animated, too cool for me!
I remember when jQuery was released, I had a friend of mine looking at its animations and he almost froze? and so did I. jQuery common methods like show(), hide(), slideUp(), slideDown() ruled or years in UX, even Google used jQuery for its first versions and of AdSense. Today we got way better stuff. First of all, Google switched to GreenSock due to jQuery performances behaviors and inefficiency. If you inspect the code behind the top coolest websites around using animations, no one of those use jQuery. Even more, you can get simple and effective animations using plain CSS transitions. That?s why this implementation is after all a sort of a fork crossroad: use CSS transitions if you need basic animations, or use a dedicated framework if you want really fast and smooth animations. jQuery is not that cool in that actually, it just was a precursor.
No way: jQuery selectors are fundamental
One of the key factors that made jQuery popular and easy to use was the ability to select DOM elements using CSS selectors. They have been considered far better than document.getElementById() and other Vanilla methods just because of their simplicity and effectiveness. But? do you know document.querySelectors? They?re supported for IE 9+ and all common browsers and it?s just Javascript. In about a year or less it will be considered the reference way to select DOM elements. Adios!
No way: jQuery simplifies AJAX
Another factor of goodness about jQuery popularity was the ability to produce XHR requests with a simplified syntax. Moreover, the $.ajax method is even more simplified with $.post and $.get methods. jQuery not only did simplify the way to code XHR requests, it also made them work on all browsers in the IE 7 and beyond era. Today, anyway, you can use a new XMLHttpRequest() to make HTTP requests work on IE 10+.
No way: jQuery is integrated in Bootstrap and other UI frameworks
Bootstrap always made use of jQuery to make all UI interactive components work: dropdown, accordion, carousel… they all work thanks to jQuery. Today Bootstrap 4 dropped support to old browsers introducing Flex as its basic grid system instead of columns percentage widths, compared to version 3. And you know what? Boostrap 5 is under development yet and it will drop jQuery from its requirements, meaning that all those UI components will work using modern Javascript more than the same-old jQuery!
Conclusions: way. jQuery is almost useless?
Has you have seen, all major factors that made jQuery popular over the years are today replaced with alternative approaches using plain Javascript or dedicated libraries. Considering the support for IE 9 and other old versions of popular browsers, we could still need some months to consider them deprecated.
But one things is for sure. In less than 1 year jQuery will be totally useless for new projects even if it will supported for some more. After all, with the advent of Angular, Vue and React, jQuery is just becoming a long date friend, one of those you can?t wait to leave and abandon forever.