Workaround for Firefox failing on RemoveText_CopesWithEmptyTextNodes

and some clean-up