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
Just FWIW, since the current behaviour does not care about ordering, the test case proposed in that issue does not help much here.

I think it would be good to follow up on this and make sure resolveElementClasses() can respect ordering, but for the time being it doesn't.

I think fixing that is sort of out of scope for this PR, but I will look at taking that on once this is merged