added ancestor() method to AbstractElement