public static @Nullable <T> T getParentOfType(final DomElement element, final Class<T> requiredClass, final boolean strict) {
    for (DomElement curElement = strict && element != null? element.getParent() : element;
         curElement != null;
         curElement = curElement.getParent()) {
      if (requiredClass.isInstance(curElement)) {
        return requiredClass.cast(curElement);
      }
    }
    return null;
  }
public static @Nullable <T> T getParentOfType(final DomElement element, final Class<T> requiredClass, final boolean strict)