Oh dear, you are right. In my test I was using getElements and for
some reason thought it was getChildren.

Thank you! (Sorry for posting such a stupid question...)

Michal.

On Dec 30, 4:36 pm, nutron <[email protected]> wrote:
> element.getChildren should only return immediate descendants. it does in my
> quick test of it.
>
> On Tue, Dec 30, 2008 at 3:32 AM, Michal-2 (via Nabble) <
> [email protected]<ml-user%[email protected]>
>
>
>
> > wrote:
>
> > This is probably something really simple, but I can't figure it out
> > how to do it simply.
>
> > I would like to find all the direct children of an element that are of
> > a given tag type. Just a "getChildren" doesn't work as that gets all
> > descendants (contrary to its name name).
>
> > I am looking for all direct "li" child elements from "rootMenu". The
> > best I have come up with is:
>
> > var descendents = rootMenu.getElements('li');
> > var laterDescendents = rootMenu.getElements('li li');
> > var children = descendents.filter(function(child) {
> >   return !laterDescendents.contains(child);
> > });
>
> > But there must be a simpler, and more efficient way: can anyone help?
>
> > Michal.
>
> > ------------------------------
> >  View message @
> >http://n2.nabble.com/Direct-children-and-not-later-descendants-tp2092...
> > To start a new topic under MooTools Users, email
> > [email protected]<ml-node%[email protected]>
> > To unsubscribe from MooTools Users, click here< (link removed) >.
>
> -----
> The MooTools Tutorial:  http://www.mootorial.comwww.mootorial.com
> Clientcide:  http://www.clientcide.comwww.clientcide.com
> --
> View this message in 
> context:http://n2.nabble.com/Direct-children-and-not-later-descendants-tp2092...
> Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to