$new_parent->push_content( $img->clone ); $img->replace_with($ new_parent );