fix(ngAnimate): defer DOM operations for changing classes to postDigest

When ngAnimate is used, it will defer changes to classes until postDigest.
Previously, AngularJS (when ngAnimate is not loaded) would always immediately
perform these DOM operations.

Now, even when the ngAnimate module is not used, if $rootScope is in the midst
of a digest, class manipulation is deferred. This helps reduce jank in
browsers such as IE11.

/CC @tbosch --- alternative/more general fix here

Closes #8234
Closes #9263
It works well enough.

A strategy I would have gone with is to instead just put each class in the object as a property name, and on add set its value to 1, on remove set its value to -1 --- but this changes the shape of the object, and indexed properties can be optimized a bit there, so it's likely that the current scheme performs a bit better. I don't think it's likely to make any difference since nobody has complained about this in ngAnimate yet.