Are We Becoming jQuery Developers Instead Of JavaScript Developers?

Recently, a fellow web developer asked me an interesting question: how strong are your JavaScript skills without frameworks like jQuery, YUI, etc.? While I am fairly confident in my JavaScript skills as a whole, it did make me step back and think: because of it’s prevalence, am I becoming less of a JavaScript developer and more of a jQuery developer? Are jQuery’s abstractions causing us (as developers) to forget how to work some of the more low-level areas of the language? For example, to stop even propagation in jQuery, you only need to do something like this:

$('#someElement').on('click', function(e) {
    e.stopPropagation();
});

However, because of the different ways IE and other browsers handle events, you’d need to do some additional checking in vanilla JavaScript:

document.getElementById('someElement').onclick = function(e) {
    e = e || window.event;
    e.cancelBubble = true;

    if (e.stopPropagation !== undefined) {
        e.stopPropagation();
    }
}

Now you might be asking what’s wrong with being dependent on a library that’s so widely used and saves us so much time? Good question. I see the problem as two fold:

1. We Use Many of Its Features Even If It’s Not the Most Efficient Approach

jQuery provides us with a lot of really cool features, especially when it comes to simplifying how we find and manipulate DOM elements. For example, here’s how we would usually go about changing the background color of an element:

$('#test').css('background-color', '#000000');

Compare this with the vanilla JavaScript approach:

document.getElementById('test').style.backgroundColor = "#000000";

It’s not nearly as compact or flexible. However, if you run a speed comparison against the vanilla JavaScript implementation, the vanilla version wins by a longshot.

2. It’s Prevalence Makes it Difficult to Get a Straight Answer on Q&A Sites / Forums

If were to go to a popular Q&A site like Stack Overflow and ask a question like How do I attach an event listener to a DOM element in JavaScript?, there’s a pretty good chance that one or more or perhaps all of the answers you’ll receive will be how to attach an event listener using jQuery. It’s almost as if jQuery’s prominence in web development has caused it to become synonymous with the very language it’s written in.

Now, I’m not saying that jQuery itself is causing the content of web forums and help sites to become one-sided or go down hill. What I am saying is that the shift towards jQuery-oriented answers from basic JavaScript answers is causing a loss (or at least a muddying) of resources regarding how JavaScript works. It makes it difficult for new developers to get started with the language and for veteran developers to diagnose problems and create new solutions.

A Challenge: Go Without (For Just a Bit)

In the end, what I’m suggesting is that you take the time to relearn and rediscover JavaScript without jQuery. Write a dropdown menu, create a form with some validation, bind some events to some elements the old-fashioned way. Take the time to experience some of the pain-points that jQuery helps us navigate around if only so you can understand them better.

What Do You Think

I’d love to hear another developer’s opinion on this. Are we becoming to dependent on jQuery (and other libraries / frameworks)? Leave a comment below.