Move line hight calculation to before pre is removed from DOM