SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 141 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

text() );
});
Chaining works so well because jQuery returns a jQuery object each time. In fact, $() is
really just a shortcut to the jQuery function. The function uses itself as a class to instantiate
new objects from itself each time it is run. In doing so, the jQuery object can be accessed
much like a singleton (as in the following example) or as an object generator (as in the preceding
examples). This example instantiates an Ajax request and grabs the responseText property
from that, assigning it to a variable (check out Chapter 5 for more information on how Ajax
works):
var html = $.ajax({
url: "/servercall/",
async: false
}).responseText;
For documentation on jQuery, visit http://docs.jquery.com.
Yahoo! UI Library (YUI)
YUI (http://developer.yahoo.com/yui) is developed and backed by the folks at Yahoo! It??™s
used on many of the Yahoo! properties, so it??™s well designed and extremely robust. YUI takes
a more traditional approach to its library design??”each method is simply a function call that
takes a number of parameters. You don??™t get method chaining as with jQuery or the conveniences
of many of the functions within Prototype (but take a look at DED|chain, mentioned
later in this chapter, which extends YUI to include method chaining). What you do get is a
well-thought-out library and prebuilt functionality that goes beyond many of the libraries
mentioned in this chapter.


Pages:
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6