workaround for IE when manipulating classes. fixes #937 fixes #1017