AJAX - The Complete Reference

(avery) #1

PART II


Chapter 5: Developing an Ajax Library 213


raw XHR request. In Prototype, an Ajax.Request object is instantiated with a URL and an
object that contains options for the communications. For example:

new Ajax.Request("http://ajaxref.com/ch1/sayhello.php", {method: "GET"});

The first parameter here is the destination URL, and the second contains an options
object literal that, in this case, contains solely the HTTP method to be used. The options
object is similar to that used in this book’s library. The complete set of options supported in
Prototype 1.5.1.1, which is what is documented in this section, is shown in Table 5-7.

YUI Library Feature Description
Animation Manager Animation facility to move and slide objects.
Browser Histor y Manager Facility to provide mechanism to support bookmarking and back
button within Ajax-style applications. At the time of this book’s writing,
it is in beta and subject to change.
Connection Manager XHR wrapper and helper facilities.

DataSource utility A common inter face for YUI components to interact with data
sources, whether those sources are hard-coded values in script or
the result of calls to data providers.
Drag and Drop utility Provides a rich set of features for implementing drag-and-drop
functionality.

DOM Collection Convenience methods for DOM manipulation. Currently less focused
on selection in comparison to other libraries.

Element utility Wrapper class for manipulating XHTML elements with the DOM more
easily.

Event utility Facility to normalize event management across browsers.
Global object Base object that creates a namespace and provides a few common
functions.
Logger facility A useful logging system that allows you to send messages of various
types to a floating dialog. If you are still using alert() dialogs to
debug, you should investigate a replacement such as YUI’s logger.
Variety of inter face widgets While not over whelming in the variety of widgets provided, YUI does
provide the primar y inter face widgets needed for rich Web application
development including autocomplete, button, calendar, color picker,
containers such as panels and dialogs, data tables, menus, sliders,
tab views, and tree views.
CSS Templates YUI provides a set of CSS templates to address cross-browser
compatible layouts. Readers who have struggled with the cross-
browser issues of style sheets are highly encouraged to take
advantage of Yahoo’s effort.

TABLE 5-6 YUI Version 2.3 Features
Free download pdf