Only assign className if changed in addClass and removeClass

This aids performance in some browsers (where adding/removing a
class which is already present triggers a CSS render anyway).