
The jQuery JavaScript library was released 9 years ago, and since then this open source project has made a significant contribution to the world of web development. Certainly interesting to look back and look at the origins of jQuery.
In April 2015, jQuery creator
John Resig published the very first version of jQuery in January 2006. In this post, John added code to memories of how jQuery was created.
Here are a few things you can learn by studying John’s comments:
1. jQuery was originally called JSelect.
But the
JSelect.com domain name was taken, but
JQuery.com was not. The first letter in the title began to be written lowercase a little later, but at first it was "
JQuery ".
')
A source2. jQuery was licensed under Creative Commons.
A
Creative Commons (CC)
license is usually associated with creative works: photos in drains, PSD templates, icon sets, and more. But CC was not suitable for open source. Moreover, at this time there were already more suitable licenses for open source.
In addition, even the
Creative Commons guys themselves
recommended licensing open source software under the MIT or GPL. Also, the
Open Source Initiative , an organization dedicated to promoting the idea of ​​open source,
opposed the publication of open source projects under a Creative Commons license. Despite all this, in 2006, John published the first version of jQuery under this license. JQuery author acknowledges that using the
CC Attribution-ShareAlike license was a bad choice. Soon the project changed the license to MIT.
A source3. jQuery was created without a version control system.
Today it is impossible to imagine any serious open source project that would be produced without the use of a
version control system (VCS). But at that time, the author of jQuery did not even think about using VCS for his project! In fairness, we note that then even large projects did not use VCS. jQuery switched to the version control system (it was SVN) only with the advent of the first contributors.
A source4. The jQuery name was “stolen” from another project.
The name “jQuery” also wore a SQL library in Java. But John Rezig found out about the name conflict only when the creators of “Java-jQuery” contacted him. John recalls that then he was upset because of all this confusion.
A source5. jQuery was introduced to the public in New York.
The jQuery public debut took place in January 2006 at the
BarCamp conference in New York. BarCamp is a technology conference that discussed Internet and open source technologies.
A source6. jQuery has been greatly influenced by other open source projects.
In the comments, John mentions several projects that had the strongest impact on the development of jQuery:
- Prototype JavaScript framework
- moo.fx
- Xpath
- Behaviour.js
Of all these projects, only
Prototype is still active. The remaining projects are no longer being developed.
XPath moved to the status of W3C recommendations back in 1999 and has not changed since then, in contrast to HTML and CSS.
7. The first jQuery plugin is JSON for jQuery.
Created in January 2006, the
plugin provided an easy way to work with JSON data. Also, the plugin showed that jQuery has great prospects precisely because of the extensibility of its functionality with the help of plug-ins. In the future, one of the reasons for the success of jQuery was a large number of plug-ins from third-party developers.
A source8. JSLint was used in jQuery for quality control.
In his contemporary comments on the code, John Rezig noted the places that he thought were not good enough. This problem was later solved with the help of
JSLint - a tool for analyzing JS code.
A source9. jQuery initially did not have Ajax support.
Asynchronous web applications were in vogue in the early to mid-2000s. Today, many web applications work asynchronously, and this is no surprise. But then it was a revolutionary idea, and many web developers rushed to jump on the steps of this train. We all wanted to avoid completely reloading our pages, and update only the part that is required. Surprisingly, jQuery did not have Ajax support in its first version.
A source10. The jQuery code did not use curly brackets if they were not required.
It is considered good practice to use braces in block constructions, even when it is not required by JavaScript. Using curly braces prevents mistakes, especially when working in a team.
JSLint , which was mentioned above, considers the absence of braces to be an error. However, in the first version of jQuery, John chose to omit the optional curly braces. “I really didn’t like the extra brackets,” explains John, “This style of code tormented us all and caused many logical errors in the future.”
So in the first version of jQuery you can find the following code:
if ( !b ) for ( var j in a ) this.style[j] = a[j]; else this.style[a] = b;
With curly braces, this code should be written like this:
if ( !b ) { for ( var j in a ) { this.style[j] = a[j]; } } else { this.style[a] = b; }
A sourceAuthor's note : at one time I was also a fan of not using optional curly braces. I thought that such code is easier to read. In addition, the code without braces resembled the syntax of new cool web frameworks that appeared at that time.
11. The jQuery 2006 API is still supported.
Your favorite jQuery methods, such as .css (), .toggle (), .show () and .hide (), were in the very first version and are still supported by the API. And for these 9 years compatibility with old versions has not broken in them. “There is a high probability that if you take the code that uses jQuery 2006 and connect modern jQuery to it, it will still work,” says John.
A source+ 1 fact that you already know:
jQuery makes web development easier.
Initially in jQuery I was attracted by the syntax. I remember thinking how laconic and straightforward he was.
Thanks to the
$ () function, working with elements of the DOM tree took only a few lines. You did not need to initiate an object to store the selected element, loop through the object, and bind events to each element in the object. You could simply select DOM elements and bind them to any number of methods. And it only takes a few lines. I just can not believe that this functionality was in jQuery right from the first version.
I remember when jQuery first appeared. I think I used
Prototype +
moo.fx then . Or maybe it was
Dojo . Or maybe
Prototype +
script.aculo.us . Or maybe I used them all together. Of course, at some point I stopped at
MooTools . At that time, I adored MooTools. I even wrote a
book about him. (For those two buyers of my book:
Mom and Dad, you are great, thank you. You always supported me. ) But I confess, with jQuery, everything worked out much faster. Another jQuery was useful because I could hire less experienced developers, because jQuery has a simpler syntax and concept compared to Protoype, Dojo or GWT.
The development of modern web projects is moving towards connecting multiple third-party dependencies. jQuery recognizes this trend and is only getting better with numerous third-party libraries. While I was reading John's comments, it became obvious to me that the ease of use of the library was the basis of the jQuery philosophy from the very first day of the project.
For example, you can find such comments:
- “I wanted to give you the opportunity to write very simple code. I was fascinated by this. ”
- “I have always loved the .wrap () method. When writing from scratch, this thing delivers real pain, and, of course, it is very convenient to have it as a single method. ”
jQuery was one of the few open source projects that
emphasized the importance of good documentation. At that time, there was simply no friendly documentation in open source projects; this did not correspond to the open source code culture. It was believed: “You are a programmer. You will understand. "
Open source project
for developers in the mid
-2000s . And he was thinking about
convenience for developers?
Seriously ? It was unusual. The user-friendly jQuery philosophy has attracted many ordinary web developers like me. And if you look at successful open source projects today —
Bootstrap ,
WordPress ,
Sass ,
Chrome (which even have built-in developer tools) —the idea to simplify the developer’s life unites them.
jQuery is more than a tool that helps build modern websites and that has saved us months of web development. JQuery's greatest achievement is not that it is used by millions of sites. This is just a side effect. For me, the most important thing about jQuery is that a small library (only 83 KB) made fundamental changes in the open source culture and the web development industry. I don’t think this is exactly what John wanted to achieve. But this is what he can say 9 years after the presentation of his modest JavaScript library at BarCamp.
John Resig made 40 comments on the source code of the first version of jQuery. All of them are here:
Annotated jQuery Release . You can also read about this
article on John's blog. And even more interesting facts about jQuery can be found by reading the
project history page on the official website.