You Really, Really, Really Don't Need JQuery

"What's next? Now more than ever ever ever you might not need JQuery?" - some Reddit comment

It's that time again!

Thought these articles were done for? No sir! Much like JQuery itself, they refuse to die.

It's almost the year 2019–the future–but instead of flying cars and moon colonies we have..... jQuery. Bummer.

The (in)famous You Might Not Need jQuery says

Some developers believe that jQuery is protecting us from a great demon of browser incompatibility

And it's this misconception - about what jQuery actually does for you - that this article will explore in depth.

The Jungle of (Historical) Incompatibilities

JQuery was born (2005-2006) into a web environment where people still talked about document.all vs document.layers vs getElementById. For instance, this blog post from late 2003 implores developers to stop using document.all and switch to the standardized getElementById supported by both IE5 (1998) and Netscape 6 (2000). Of course, developers were reluctant to move entirely to the standardized method, choosing instead to feature-detect for each option for fear they might alienate a small percen--- oh my god this sounds so familiar when will the madness end.

Suffice to say, it was difficult to do even the basic heavy-lifting (like DOM manipulation) that dynamic JavaScript applications required (then called AJAX or "Web 2.0" applications). Other tasks like events or dynamic requests to the server suffered from a lack of an API that could be relied upon cross-browser. To use events, you had to support both attachEvent and addEventListener which had various quirks, most notably the competing bubbling and capturing models of event propagation. XMLHttpRequest was going through similar growing pains, requiring different code paths for different browsers

JQuery was one of many "AJAX libraries" at the time, and not the first to allow DOM manipulation through CSS syntax.

It Doesn't Do As Much As You Think

We all have different clients with different requirements. As we all know, the one browser that's done the most to single-handedly hold back the progress of the web is Microsoft Internet Explorer. We web developers live in constant fear of the mythical legacy enterprise application, hiding deep in a cave somewhere, where one corporation is running IE6 on their UNIVAC and you can't afford not to support them.

At least, we used to. This is no longer a valid objection.

If your client - yes yours - wants IE 9 or 10 support, then your client is wrong (and by the end of this article you'll be armed with knowledge, prepared to break the news to them about their wrongness)

Which Browsers?

For comparison, jQuery 3.x supports...

  • The "evergreen" browsers (Chrome, Firefox, Edge, Opera) at most 1 version back
  • iOS 7+
  • Android 4.x +
  • IE 9+

But jQuery is being overly conservative. Of these, which do we need to be concerened with, and how many weird quirks do they have?

  • IE: We only need to care about IE11, as we'll discuss below.
  • Android: As of Android 4.4 the system WebView is Chromium-based, and of Android 5 it became updateable, keeping pace with Chrome (Chromium). Versions <= 4.3 have their own rendering engine with their own weird quirks.
  • iOS 7: This is nearly as old as IE 10. However, devices as old as the iPhone 5s (2013) have the option of upgrading to iOS 12.
  • Evergreens: True to Microsoft tradition, Edge lags a bit behind the rest, but generally speaking users have mostly migrated to a new version every few months.

Who matters? Let's look at the stats. To start with, there's the Android OS version stats. These statistics show 11% of Android users on Android 4.x, but this is based on Google Play store stats, not web browsing habits, and Android users on 4.1+ are able to download Chrome or Firefox.

Depending on whose web stats you believe, Android 4.x actually accounts for about 0.5% of web visits, iOS < 11 for ~1%, and IE11 anywhere from 2-10%

There's No Excuse For Supporting IE <11

IE10 and lower were obsoleted - completely abandoned - almost three years ago (January 2016). Windows XP was kicked to the curb in 2014. That means that anything older than IE11 on Windows 7 is a security risk. For government agencies and some businesses, they may be violating compliance requirements.

But what about average users for public-facing websites? By any measure, IE <11 appears to have less than 1% of market share. IE 7, 8, 9, 10 are each a fraction of a percent of users.

"But what if a stray IE8 user wanders into my website and it's all broken and I look like a fool"

Those users just don't matter. Let it go.