Hey,

Jean-Philippe Encausse a écrit :
> But it is an example. So my question is: should we use 
> Element.hasClassName() in a loop
> or something more straight ?

The more concise code is usually better :-)  After all, the $$ call will 
extend all elements it returns, too.  Note, btw, that your call:

        $$('a.disabled')

is NOT equivalent to your manual loop: it doesn't look for disabled 
classes in the parent nodes of links, but on the links themselves. 
You'd want:

        $$('.disabled > a')

However, if using hasClassName is critical for whatever reason to your 
code, you should not be too fearful: hasClassName, 
getElementsByClassName, Element.ClassNames are currently supposed to get 
some TLD in Prototype 1.6.

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