immediateDescendants :: Element

immediateDescendants(element) -> [HTMLElement...]

 

Collects all of the element’s immediate descendants (i.e. children) and returns them as an array of extended elements.

 

The returned array reflects the children order in the document (e.g., an index of 0 refers to the topmost child of element).

 

Note that all of Prototype’s DOM traversal methods ignore text nodes and return element nodes only.

 

Examples

 

<div id="australopithecus">

  <div id="homo-herectus">

    <div id="homo-neanderthalensis"></div>

    <div id="homo-sapiens"></div>

  </div>

</div>

 

$('australopithecus').immediateDescendants();

// -> [div#homo-herectus]

 

$('homo-herectus').immediateDescendants();

// -> [div#homo-neanderthalensis, div#homo-sapiens]

 

$('homo-sapiens').immediateDescendants();

// -> []

 


Prototype API 1.5.0 - prototypejs.org