code: public static boolean failSafeRemove(Node parent, Element child) {
          //noinspection SimplifiableIfStatement
          if (parent != null && child != null && parent.contains(child)) {
              return parent.removeChild(child) != null;
          }
          return false;
      }
docs: Removes the child from parent if both parent and child are not null and parent contains child.
  
  @return {@code true} if the the element has been removed from its parent, {@code false} otherwise.