Remove a child element only if it doesn't have a parent