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
@caitp: It discards them, if the are "added" and "removed" the same number of times (i.e. if they appear in the `add`/`remove` arrays the same number of times).

My question is basically this: _"Shouldn't order matter ?"_
E.g. if something says _"add that class"_ and then (later, but in the same $digest) something else says _"remove that class"_, shouldn't we remove it ?
The point is that the order of calling addClass/removeClass is not "respected". Do you think order should matter or is it fine as it is ?