docs: @SuppressWarnings("unchecked")
      public <T extends ElementBase> T getAncestor(Class<T> clazz) {
          ElementBase parent = getParent();
          
          while (parent != null && !clazz.isInstance(parent)) {
              parent = parent.getParent();
          }
          
          return (T) parent;
      }