Minimize the number of DOM insertions while rebuilding some popups