Michael Raichelson

Sorry, jQuery...

This is one of those posts I'm really not sure how to start or phrase. I was a jQuery user since it was pretty much was released. I remember submitting a bug early on about $(document).ready() not firing properly when used on pages alongside document.write() code for Google Ads from the publishing company I used to work for in...errr...2005-6ish?

Point being: jQuery was a solid piece of kit through a large part of my career.

Then we got reactive JS frameworks, and now I struggle to find reasons to use jQuery for myself. Almost everything I've touched lately has been either Vue if it's a significant (and largely self-contained) project (a full interactive component embedded into a page on a site, or a full site built on Nuxt *cough* for example), or AlpineJS for smaller components, enhancements, and interactions to mix into other codebases. I've come to really like these kinds of toolkits a lot.

So here's my problem (and I'm especially looking at you, Shopify App developers): I keep having the performance of sites I work on get bogged down by people who still develop based on jQuery as their starting point. Especially in cases where they...

  • Just assume that your site will have jQuery installed on it already (to do things that there's now vanilla JS options for and CSS animations to handle)...leading to JS errors when it's not.
  • Inject their own copy of jQuery into pages (either without checking if it's already on the page, or to include their one specific version that their code was built against)...when it might not be necessary.
  • Not only smuggle in jQuery but multiple plugins as well (or just assume their existence again)...as full libraries and not tree shaking them to only the necessary parts or bothering with any kind of concatenation/minification.

Which is to say: jQuery you've been a great help to me.

Your friends on the other hand...

This post sponsored by me, while trying to figure out options to improve the Core Web Vitals for a client's site where there are four (FOUR!) different versions (1.10.x, 1.11.x, 2.x, and 3.x) of jQuery being added to every page, and the entire jQueryUI library (which is never actually used on the site).