On Dec 21, 2007 10:08 AM, Rob <[EMAIL PROTECTED]> wrote:
>
> This method appears to be missing something that would be quite
> useful.
> An option so that the select() method would only look through
> immediate children, exactly how childElements() and decendants()
> differ.
>
> Unless there is already a method to do this, I have not seen.. Anyone
> have any thoughts?
>
> Thanks
> Rob
> >
>
This should be easily accomplished with Enumerable#grep[1] as grep
calls match in the "expression", and Selector#match well, matches an
element :)
element.immediateDescendants().grep(new Selector("#some .selector"));
If you really want the API to be element.select(selector, true) then
you can always use Function#wrap[2] :)
Best,
-Nicolas
[1] http://prototypejs.org/api/enumerable/grep
[2] http://prototypejs.org/api/function/wrap
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---