Why is there such profound and intense hatred towards jquery library in the WebDev world?


In most webdev or javascript forums I've visited, one theme is quite common: Many devs there have a unilateral, profound and intense hatred towards the jquery library and this is totally beyond my understanding.

The most commonly cited reason is its size which is about 95kb in most minified versions. But considering the power & flexibility it gives to the developer (terse and simplified way to access selectors, events, ajax, etc.), is 95kb really that much of a huge deal in the digital age of 2019?

Remember, we are living in an era where news and social media sites easily download tens of megabytes of data in adware alone!

As much as some devs would like jquery to vanish from the face of this world, its not going to happen any time soon and the reason is simple: jquery is ubiquitous in use and some of its ways have no other alternatives. Consider the following oft used jquery snippet for instance:

$(document).ready( function () {
    console.log('Do Something');
} );

The $(document).ready() is one of the most common jquery constructs which many webdevs have grown up hearing. Now, consider the pure JS way of doing this exact same thing (hint: most webdevs won't even know this unless they googled for "pure js way of document load" or something first!):

document.addEventListener("DOMContentLoaded", function(event) {
    // Your code to run since DOM is loaded and ready
});

It shouldn't take a genius to tell you which is more readable, terse and preferable. Another quite common use of jquery is DOM selection. Anyone who tells you that document.querySelectorAll("div.foo") is more preferable to $("div.foo") need to have their head examined.

Another baseless allegation against jquery is that it is "old and outdated". Granted that its old, but its also rock solid in stability and doesn't need tweaks and updates every now and then like so many other libraries in the npm galaxy ecosystem. Considering that the usual shelf life of a shiny new library or framework in JS world is hardly a couple years, devs should be proud of jquery, not trash it as something old and outdated.

The ajax syntax of jquery is so powerful that it has become second nature to many JS devs:

$.get("/foo", function(data){
    //handle data
});

$.post("/foo", {x:100, y:200, z:300}, function(data){
    //handle data
});

The pure JS alternatives to these are so unpleasant that most devs won't even try to recall it, trust me!

Now, the question that naturally arises is how can someone dislike something so useful in daily programming! Is it basically the psychological impostor syndrome that sits deep within our subconscious minds and tells us to dislike all good things in life? What do you think? Please let me know in comments.


Comments !