Fix for failure on IE8

It has, however, some strange jerking behaviour when deleting characters and there are spaces in the text.