YUI Hidden Treasures: Selector - the Fire from Heaven
While there are many many reasons to use YUI libraries, you probably know about the most popular features or perhaps are stuck on your favorite JS library. Or, perhaps you are new to DHTML development and are just not quite sure which one to try out. My goal with these posts is to jump into the thick of YUI and bring back some gems from the depths.
One gem which almost outshines them all is something that you may not know even exists inside YUI. It's called Selector and consists of code that allows you to use CSS3 style selectors to grab a hold of DOM nodes. Imagine if the DOM was a database and Selectors are the SQL statements to access various pieces and parts.
Doesnt sound too intersting? Well with today's standards of using classnames for states and unobtrusive javascript, you can use Selector to do such things as grab all A tags that are children of your sidebar class and add a title attribute for accessibility. Or use the powerful attribute selector to make divs that are 300px wide be green. All kinds of really interesting possibilites open up.
So, if you have been stuck on YAHOO.util.Dom.get, give Selector a try.


