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-tp2092065p2092065.html
> 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.com www.mootorial.com 
Clientcide:  http://www.clientcide.com www.clientcide.com 
-- 
View this message in context: 
http://n2.nabble.com/Direct-children-and-not-later-descendants-tp2092065p2092952.html
Sent from the MooTools Users mailing list archive at Nabble.com.

Reply via email to