Chris, Many thanks! I did not know about 'first-child' or '>' ... have been using $$('a'), $$('#foo'), etc for grabbing arrays of links, divs, etc. ...this takes it a step further! ...the power of Prototype is awesome. cheers, Mark
On 6/3/07, Christophe Porteneuve <[EMAIL PROTECTED]> wrote: > > > Mark Holton a écrit : > > Wild. ...can I trouble you for a short explanation on that, Chris? > > Sure thing. > > > $$('#box > *:first-child a.tooltip') > > A bona-fide CSS3 selector: > > #box -> filters on a container with id="box" > > -> following selector must pertain on child, not descendant > * -> we don't care about the tag name > :first-child -> CSS3 pseudo-class that restricts the previous > selection to first children only, hence the > equivalence with .firstDescendant() > (space) -> now we can go to any depth > a.tooltip -> a-tag elements with a "tooltip" CSS class > > > Selector.findElements($('box').firstDescendant(), ' a.tooltip') > > $$(...) is basically Selector.findElements(document, ...). > > This method performs the selection within the scope of the DOM node it > takes as its first argument. So using it explicitly lets you specify > the scope. > > 'HTH > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: [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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---