descendantOf :: Element

descendantOf(element, ancestor) -> Boolean

 

Checks if element is a descendant of ancestor.

 

As descendantOf() internally applies $() to ancestor, it accepts indifferently an element or an element’s id as its second argument.

 

Examples

 

<div id="australopithecus">

  <div id="homo-herectus">

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

  </div>

</div>

 

$('homo-sapiens').descendantOf('australopithecus');

// -> true

 

$('homo-herectus').descendantOf('homo-sapiens');

// -> false

 

 


Prototype API 1.5.0 - prototypejs.org