public static @NotNull DomElement getRoot(@NotNull DomElement domElement) {
    while (true) {
      final DomElement parent = domElement.getParent();
      if (parent == null) {
        return domElement;
      }
      domElement = parent;
    }
  }
public static @NotNull DomElement getRoot(@NotNull DomElement domElement)