On Jan 23, 2008 2:27 PM, elduderino <[EMAIL PROTECTED]> wrote:
> Does using the $$ give extend an element like $ does? I can't find a
> clear answer on this so i thought i'd post.

Yes it does, but keep in mind it returns a collection of elements, not
a single one. Even when your selector only matches a single element
(like $$('html body')).

> Also can i use functions like down and each on anything or does it
> have to be an extended element? (obviously i know that i could only
> use each on an iterable object and down on an object with children)

Yes, but on individual items in the returned collection, not the
entire collection itself.

// hide every div with a class of "custom-class"
$$('div.custom-class').invoke('hide')

// iterate over the same collection, updating the *first* paragraph
with new text
$$('div.custom-class').each( function( element ){
  element.down('p').update('I was here');
});

-justin

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