I actually find certain traversal methods too limiting. We could
easily make siblings/ancestors/etc. accept an optional selector/
iterator argument (or even both, where function would be treated as
iterator and string as selector). This also leads to a better
performance. I cooked a patch for this some time ago
http://dev.rubyonrails.org/ticket/11143 Does this make sense?

- kangax

On Jun 19, 7:13 pm, "Dan Dorman" <[EMAIL PROTECTED]> wrote:
> On Thu, Jun 19, 2008 at 4:56 PM, kangax <[EMAIL PROTECTED]> wrote:
>
> > Dan,
> > not sure what Array#match is, but #grep could do this nicely : )
>
> > $(someElement).siblings().grep(new Selector('.someClass'));
>
> Yep, I'm not sure what I was smoking exactly, but I think it had some
> jQuery in it :)
>
> By way of penance, some extra credit work. Louis, If you find yourself
> needing this functionality a lot, you could always augment the
> behavior of siblings using Function.wrap:
>
> Element.addMethods({
>   siblings: Element.siblings.wrap(function(proceed, element, selector) {
>     var sibs = proceed.call(this, element);
>       return selector ?
>         sibs.grep(selector instanceof Selector ?
>           selector :
>           new Selector(selector)) :
>         sibs;
>   })
>
> });
>
> :Dan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to