I need to grab $(''box'').firstDescendant() then use $$(''a.tooltip'') on that element. How can I chain link those? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Daniel Eben Elmore a écrit :> I need to grab $(''box'').firstDescendant() then use $$(''a.tooltip'') on that > element.How about: $$(''#box > *:first-child a.tooltip'') Otherwise, you can go: Selector.findElements($(''box'').firstDescendant(), ''a.tooltip'') -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Wild. ...can I trouble you for a short explanation on that, Chris? Many thanks Mark On 6/3/07, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > > Daniel Eben Elmore a écrit : > > I need to grab $(''box'').firstDescendant() then use $$(''a.tooltip'') on > that > > element. > > How about: > > $$(''#box > *:first-child a.tooltip'') > > Otherwise, you can go: > > Selector.findElements($(''box'').firstDescendant(), ''a.tooltip'') > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Excellent! Thanks for those gems. :] -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Mark Holton Sent: Sunday, June 03, 2007 4:23 AM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] Re: Using $$ within an element. Wild. ...can I trouble you for a short explanation on that, Chris? Many thanks Mark On 6/3/07, Christophe Porteneuve < tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote: Daniel Eben Elmore a écrit :> I need to grab $(''box'').firstDescendant() then use $$('' a.tooltip'') onthat> element.How about: $$(''#box > *:first-child a.tooltip'') Otherwise, you can go: Selector.findElements($(''box'').firstDescendant(), '' a.tooltip'') -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org <br --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
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 <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Holton a écrit :> 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.$$(''#x'') is actually a convoluted, slower way of doing $(''x'')... Just look at the online ref [1], and dive into the CSS3 Selectors [2] spec. Plenty of jewels in there. [1] http://prototypejs.org/api/utility/dollar-dollar [2] http://www.w3.org/TR/css3-selectors/ -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
...I''m going to be looking at the css3-selectors reference often in the next month. That''ll be a fun one to master, thanks for the reference! On 6/4/07, Christophe Porteneuve <tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> > > Mark Holton a écrit : > > 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. > > $$(''#x'') is actually a convoluted, slower way of doing $(''x'')... > > Just look at the online ref [1], and dive into the CSS3 Selectors [2] > spec. Plenty of jewels in there. > > [1] http://prototypejs.org/api/utility/dollar-dollar > [2] http://www.w3.org/TR/css3-selectors/ > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---