06.05.2013 Views

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>jQuery</strong>: Do More with <strong>Drupal</strong><br />

I've never been happier to eat my words.<br />

With the birth of dynamically refreshing page renderers <strong>and</strong> the XMLHttpRequest<br />

(XHR) object (or control), <strong>JavaScript</strong> suddenly became a much more powerful tool<br />

for manipulating the contents of a page without requiring a full round trip to a<br />

remote web server.<br />

XMLHttpRequest <strong>and</strong> AJAX (Asynchronous <strong>JavaScript</strong> And XML) will be<br />

the subject of Chapter 5.<br />

But with all of this new power came a fair amount of <strong>com</strong>plexity. The core <strong>JavaScript</strong><br />

libraries—the tools bundled in the major browsers—have remained relatively small.<br />

And, as newer versions of browser have been released, writing working code often<br />

requires an awful lot of boilerplate "cross-browser <strong>com</strong>patibility" code.<br />

Where changes have been made, they are often <strong>com</strong>plex. The event model in<br />

Microsoft's IE <strong>and</strong> the one in Mozilla-based browsers diverged quite a while ago.<br />

The DOM API, implemented on all major browsers, is anything but simple. Anyone<br />

who has written an AJAX library from scratch will be quick to voice an opinion<br />

on the trials <strong>and</strong> tribulations of getting that library to work on all major browsers.<br />

Even manipulating a stylesheet from <strong>JavaScript</strong> has <strong>com</strong>e with its share of subtle<br />

implementation differences.<br />

In short, even while the capabilities of <strong>JavaScript</strong> had reached new heights, the<br />

<strong>JavaScript</strong> developer was often forced to use <strong>com</strong>plex APIs <strong>and</strong> work around lots<br />

of <strong>com</strong>patibility issues while building a program.<br />

As <strong>JavaScript</strong>'s capabilities <strong>and</strong> usefulness grew, another change was occurring.<br />

This was a culture change among the <strong>JavaScript</strong> developers.<br />

For a long time, the online <strong>JavaScript</strong> developers released useful snippets of code.<br />

These were not libraries in the proper sense of the word, but short snippets of code<br />

that could be copied <strong>and</strong> pasted into a project, tweaked, <strong>and</strong> then reused.<br />

As <strong>JavaScript</strong> matured, so did the <strong>com</strong>munity around it. The focus shifted (to some<br />

degree at least) from producing "useful doodads" to creating polished libraries<br />

designed for reuse in a wide variety of settings.<br />

Today's popular libraries, such as Prototype, YUI, Dojo, <strong>and</strong> the like, have all been<br />

built for general use.<br />

One of these libraries, <strong>jQuery</strong>, has enjoyed a meteoric rise to fame, <strong>and</strong> deservedly<br />

so. Why has it been so successful? It's because the focus of the library has been<br />

on taking the really difficult (but important) <strong>JavaScript</strong> tools <strong>and</strong> making them<br />

easy to use. Thus, in the words of its creators, <strong>jQuery</strong> is the "Write Less, Do More<br />

<strong>JavaScript</strong> Library."<br />

[ 60 ]<br />

This material is copyright <strong>and</strong> is licensed for the sole use by Richard Ostheimer on 18th June 2009<br />

2205 hilda ave., , missoula, , 59801

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!