code: public static void doLogicalDetachFromHtmlPanel(Widget w) {
      Widget parent = w.getParent();
  
      if (parent instanceof HTMLPanel) {
        complexPanelGetChildren((HTMLPanel) parent).remove(w);
        widgetSetParent(w, null);
      } else {
        throw new IllegalStateException(
            "You can only use this method to detach a child from an HTMLPanel");
      }
    }
docs: This method detach a widget of its parent without doing a physical
  detach (DOM manipulation).