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 137 | Next

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

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

Prototype was
originally designed by Sam Stephenson (http://conio.net) and integrated into Ruby on
Rails (http://www.rubyonrails.org). Many of the ways that Prototype approaches problems
are similar in style to Ruby.
One of the reasons for Prototype??™s popularity is the way it makes many things much easier,
including the infamous dollar sign function ($). By using the dollar sign function, methods
are automatically attached to the returned DOM element, adding a lot more power to what
you can do with an element. Recent iterations of the library have improved on method chaining,
making it a formidable tool:
$('elementId').show(); // shows an element that was hidden using display:none
Prototype, unlike other libraries, really focuses heavily on addressing two key areas: working
with the DOM and application conveniences including lots of string functions, and a
custom enumeration object that is used to extend a custom hash object and the built-in Array
object. When it comes to building web applications??”especially Ajax-driven ones??”Prototype
is a solid solution.
CHAPTER 4 n LIBRARIES 87
The latest version of Prototype also features a double dollar function ($$) for using CSS
selectors to retrieve an array of elements. Here??™s a great example of how easy it can be used to
create an expand and collapse feature for an FAQ page:
What is an apple?

It's a fruit!

$$('.


Pages:
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6