On Sep 8, 3:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I place a comment on the bug trtacker to point Kangax solution. It is
> indeed simple and effective.
> http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/24...

While it's simple and effective, the problem is inability of
`Selector` class to work with complex or multiple selectors.
`adjacent` supports passing any number of selectors to match elements
against. `new Selector` can't handle more than one and that one can
only be a simple one : )

There's a way to use grep but its O(n^2) complexity makes it ugly : /

adjacent2: function(element) {
    element = $(element), expressions = $A(arguments).slice(1);
    return Element.siblings(element).grep({
      match: function(element) {
        return expressions.any(function(expr) {
          return element.match(expr);

This would obviously work nicely if Selector constructor was able to
accept complex selectors.
Any other ideas?

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to