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.


Reply via email to