public boolean isAncestor(final Element element) {
    Parent p = element.getParent();
    while (p instanceof Element) {
      if (p == this) {
        return true;
      }
      p = p.getParent();
    }
    return false;
  }
public boolean isAncestor(final Element element)