jQuery’s creator annotates his original source code

John Resig has provided commentary and background on the creation of one of the most widely-used JavaScript libraries

Photo of jQuery creator John Resig speaking at a conference

jQuery creator John Resig

Credit: MIXEvent (CC BY 2.0)

Since its release in January 2006, jQuery has become one of the most popular JavaScript libraries, currently used by more than half the top million web sites in the world. Knowing how to use jQuery is also one of the more valuable and in-demand skills developers can have these days. Of course, in those early days nine years ago, jQuery was just another piece of open source code and now its creator has shed some light onto the birth of what’s become a pretty famous piece of code.

Earlier this month, jQuery creator John Resig annotated one of the earliest existing versions of jQuery, which was first released on January 24, 2005 at BarCamp NYC. He provided 40 comments on a version of the code dated February 3, 2006, which ran a total of 665 lines. Resig was prompted to make his annotations by Daniel Lamb as part of his jQuery Archive project.

Resig’s comments provide a number of interesting historical and technical notes about the early code. Here are some of Resig’s quotes from the annotations that I found particularly interesting:

  • He doesn’t have a copy of the very first version of the jQuery code because it wasn’t in source control yet. Resig: “I was just kind of hacking around and didn’t think much of it. It wasn’t until I started to get contributions (or interest in contributions) that I put it in to SVN.”
  • The library was originally called JSelect but since jselect.com was taken, he had to choose another name, which then became “JQuery” in this version. Resig: “I guess it took me a little bit to develop the now-preferred ‘jQuery’ capitalization!”
  • jQuery was originally released under a CC license (CC BY-SA 2.0). Resig: “In retrospect a CC license is a poor choice for code and I switched to using an MIT license pretty soon after.”
  • The original version of jQuery was meant to support IE5. Resig: “I think we ended up dropping support for IE 5 pretty soon after and ‘upgraded’ to IE 6….”
  • At the time he wrote the code, Resig didn’t appreciate the value of braces, which he since come around on. Resig: “I really dis-liked having unnecessary braces. This… unfortunate… style preference plagued us for quite a while and caused all sorts of avoidable logic errors. I like braces now, I think they provide extra clarity and help to prevent common mistakes.”
  • He’s confident that most code using the 2006-vintage jQuery code would still work today, thanks to efforts to not break backward compatibility. Resig: “... almost all of the API that we see here was left intact. I’m definitely proud of the fact that the API was ‘good enough’ to last over the next decade — and beyond.”

His annotations are a fun and interesting read which provide a valuable historical record of the development of what’s become an important set of coding tools. I recommend anybody who works with jQuery (or any historical code aficionados) to a take a look.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon