Don't remove the nodes until right before inserting the fragment