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

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

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


CHAPTER 4 n LIBRARIES 96
DED|Chain
As mentioned, YUI doesn??™t support method chaining. Many of those who have come to
appreciate jQuery??™s simplicity have found YUI to be cumbersome to work with. Dustin Diaz
developed DED|Chain (http://dedchain.dustindiaz.com) to fill that gap by taking the YUI
library and extending it to offer chainable methods such as the following:
_$('#elementID').on('click', function(){ /* code goes here */ });
This uses _$ much as jQuery uses the $ to enable the retrieval of DOM elements using CSS
selectors. In this case, it returns all objects with an ID of elementID (you should have only one)
and then attaches an onclick event handler to them.
DED|Chain is still early in development, but I want to point it out because it emphasizes
one of the key features of JavaScript: it??™s extremely flexible. Code can easily be extended to
offer the features that the core library might not take into account.
How to Choose a Library
With so many libraries out there and so many more to come, how can you ever narrow down
the field? Of course, your choice depends entirely on what you need to accomplish. As discussed
at the beginning of this chapter, libraries tend to fall into one of the three major
categories: DOM tool, application helper, or widget. You need to consider what you might be
building and narrow down the field from there.
If you just need to add some interactivity to your blog, such as simple slide effects, you??™ll
want a library that focuses on the core DOM features along with some basic effects.


Pages:
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6