Summary
The latest versions of the two popular open-source Ajax libraries include a sound API for playing MP3s inside a Web page, a refactored in-place editor, an improved class API with inheritance and superclass methods, and better JSON support. The latest versions of both libraries will be incorporated in Rails 2.0.
Advertisement
Prototype and script.aculo.us are two of the most popular JavaScript Ajax libraries. While Prototype provides a set of useful abstractions for common Ajax tasks, such as invoking an HTTP request in the background and manipulating elements of the DOM, script.aculo.us is best known for its snazzy effects, such as drag-and-drop and fade. Although not tied to any specific Web frameworks, both libraries are used extensively in many Rails applications.
Today both Prototype and script.aculo.us saw new releases, each with numerous new features. One interesting new Prototype feature centers around classes and inheritance. Although JavaScript is an object-oriented language, it does not have classes—it has prototype objects instead. Developers coming from class-based languages often have a hard to time to figure out how to use common OO idioms in JavaScript. Prototype defines a simple mechanism that provides class-like features. A tutorial on new methods for easier inheritance explains the new features in version 1.6.
Other Prototype 1.6 features include better ways to handle JSON data and numerous new methods that ease working with the browser's DOM.
Apart from its smooth Ajax effects, one of script.aculo.us's most interesting features is an in-line editor. This editor quickly turns an HTML field or some other element into an editor when the user clicks on the component, indicating the desire to enter data. In 1.8, the in-place editor received a complete overhaul. Another new script.aculo.us feature is an API for playing sounds effects based on MP3 files.
What do you think of Prototype and script.aculo.us for Ajax development? What are your favorite client-side JavaScript APIs?