Hey,

Camsoft a écrit :
> This is what I did and it works. But I was wondering if there was an
> easier way without having to use an anonymous function?

Certainly.  As emphasized on the pages for each and map/collect, calling 
the same function with identical arguments throughout an enum is an 
optimized use-case: use invoke, as in the rewrite below.

$$('#idSelector > li').invoke('addClassName', 'myClass');

(btw, I used '>' instead of a simple space because you said you wanted 
only "children" <li>'s to be affected.  If you're going for descendants, 
do use a simple space instead of the closing angular bracket.

-- 
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to