question: public static int isAncestorOf ( Element ancestor , Element maybeChild ) { int ret = - 1 ; if ( ancestor == maybeChild ) { ret = 0 ; } Node parent = maybeChild . getParentNode ( ) ; int i = 1 ; while ( parent != null && parent != ancestor ) { parent = parent . getParentNode ( ) ; ++ i ; } if ( parent == ancestor ) { ret = i ; } return ret ; }
target:  Checks if ancestor-Element is an ancestor of maybeChild Element