HTML and CSS Reference
In-Depth Information
You may have noticed that there are a few rules that are declared multiple times with a vendor prefix (the
-webkit- , -moz- , and such) that might look a little confusing. Because Css3 isn't 100 percent finalized yet, each browser
handles the new rules just a little differently.
Note
this could cause issues for developers if there was no way to compensate between browsers, so vendor prefixes were
added to allow for different rules to be applied to each browser in kind. the hope is that someday soon there will be one
unified syntax for each of the new Css3 rules, but while things are still in flux, this is a necessary evil.
JavaScript and jQuery
JavaScript is a client-side scripting language, which means that it is executed on the user's computer. This makes it
ideal for tasks such as animating the elements on a page, doing calculations on-the-fly, and various other actions that
would otherwise be extremely inconvenient if they required a page refresh.
JavaScript also allows for certain server-side actions to be performed by calling scripts asynchronously. This
technique is commonly referred to as AJAX: Asynchronous JavaScript and XML. The XML part of this term came
about because the request would commonly return XML data. Although this isn't the common use case anymore,
the name has stuck. What AJAX allows, in essence, is for a different page to be loaded and its contents returned to
the current page using JavaScript. The page that is loaded can receive data from the AJAX request, process it, store it,
retrieve new data, and return that data to the script that requested it. (We talked about this a little earlier in Chapter 1).
For all its capabilities, however, JavaScript has long been a troublesome animal due to its less-than-exemplary
documentation, sometimes confusing syntax, and inconsistent implementation on other browsers. Thus the
learning curve for JavaScript had been steep and it required a serious time investment from any developer hoping
to use it in a project.
In response to this frustration, several groups and individuals set out to simplify JavaScript and make it accessible
to everyone. They created frameworks that handled common tasks, overcame cross-browser troubles, and provided
good documentation and support communities for new developers.
There were dozens of these frameworks at first, including MooTools, YUI, Dojo, Prototype, and jQuery. Each had
advantages and disadvantages, but the one that seemed to bolster the most community support was jQuery, largely
for its great documentation and wonderfully simple syntax.
Why Do We Need It?
Improved JavaScript documentation, a general uptake in the use of the technology, and language standardization
has lead to a much better development experience for developers using the language. However, there are still cases in
which a library can be very useful. jQuery will deal with any outstanding cross-browser inconsistencies and also give
us the tools we need to perform tasks such as these:
Creating animations to indicate what's happening in the app: Showing the user what's
happening by animating various actions is a great way to enhance the user interface and it
adds to that overall polish that we're shooting for.
Handling user events: When the user interacts with the app—whether it's a click, a tap, or
a swipe—the browser fires an event that jQuery can detect and perform a task based on the
user's action.
 
 
Search WWH ::




Custom Search