CHAPTER 1 ■ EVOLUTION OF JQUERY
13
3. Set the text inside this div as “There was an error.”
4. Locate a div in the document that has the id as test.
5. Append the newly created div inside this located div. Because this located div
is already in the document, the newly created div will also get added to the
document.
Let us take up a case in which we have to manipulate some CSS attributes via JavaScript. Let us assume
that there is a div with some preset CSS attributes, and we have to change the opacity of the div using
JavaScript. Thus, the code snippet that follows is worth looking at.
var div = document.getElementById("test");
div.style.opacity = 0.5;
div.style.filter = "alpha(opacity=50) ";
Now, what has happened here is that browsers prior to IE8 did not understand the opacity attribute;
they understood filter. So, to achieve a single objective, more code had to be written in the form of code
that the individual browser could understand and, therefore, interpret.
You can easily see that the task that was performed was rather simple but that many lines of code
still had to be written. This was becoming unacceptable to developers. Someone had to take charge of the
situation, and out of the blue, something had to lead the way for web developers. Developers desperately
wanted to cut down on the amount of code they had to write. They wanted to be able to focus on the
business logic rather than the underlying browser’s CSS and JavaScript implementation. They wanted some
code that would run across all systems uniformly.
Who Was the Revolutionary?
There was this gentleman, John Resig, who used to write web applications, and he was among the same
community of developers who felt the heat writing lengthy JavaScript code, and that, too, without the
guarantee of using a hack-less approach. He continued web development and, in the course of doing so,
gathered a number of libraries he required and merged them gradually. This merger resulted in a new
bundle, and Resig continued to refine the bundle, by making necessary modifications to the existing code.
Ultimately a new bundle with the name jQuery became available to the community. Because Resig was
targeting the DOM manipulation capabilities significantly, and there was a CSS library with the name
cssQuery, the name jQuery became influential and, hence, coined.
Having done the homework all the while, Resig was creating a bundle, which he released as a
framework on August, 26, 2006. The world came to know about a new framework that was to revolutionize
the way front-end programming for the Web occurred. Even after having revolutionized front-end Web
development, Resig did not stop there. He is currently located in Brooklyn, New York, and is working as
dean of computer science at an academy while still breaking new barriers to help the web development
community a great deal.
■ Note You can obtain more information about John Resig from the Wikipedia page located at
https://en.wikipedia.org/wiki/John_Resig.
www.it-ebooks.info