> On Mon, Dec 1, 2008 at 15:26, Eoghan <[EMAIL PROTECTED]> wrote:
> >
> > It took me a while to figure this out, but at the moment I can do:
> >
> > var selector = new MochiKit.Selector.Selector('*');
> > selector.findElements(myElement, '~');
> >
> > To find right hand siblings of myElement (which doesn't have an id in
> > this case)
> >
> > If this is going away in 1.5, it would be nice to be able to do:
> >
> > MochiKit.Selector.findRelativeTo(myElement, '~ *');
> >
> > which (if the element had an id) would be equivalent to the current:
> >
> > MochiKit.Selector.findDocElements('#myElementId ~ *');
On Dec 2, 5:19 pm, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote:
> Are you using the selector_sizzle branch? Can you try '~ +' with
> findChildElements?
>
> cheers,
> Arnar
I haven't been able to get it to work with the sizzle branch (r1425) —
it fails on Selector.js L352
That version has e.g.
TAG: function(match, context){
return context.getElementsByTagName(match[1]);
}
Which assumes the descendant axis (which is obviously the intention
given the name 'findChildElements').
What I'd like to see from the API would be instead of
'findChildElements', the more general:
findRelatedElements(element, expressions)
If the axis part of the expression was left out it would be equivalent
to the current findChildElements e.g.
findRelatedElements(my_table, ['td.myclass']);
But you could also start an expression with an axis:
findRelatedElements(my_td, ['~ td.myclass']);
To find sibling nodes of a given td.
Eoghan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---