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
If I understand correclty, the class will end u in the `toAdd`/`toRemove` arrays, based on the number of times a class was requested to be added/removed.
But shouldn't the order play a more important role here ?

E.g. if in the same $digest the following calls are made:

    addClass(someElem, 'class1');
    addClass(someElem, 'class1');
    removeClass(someElem, 'class1');

I would expect that the class is not added (removed if present).
Yet, with the current implementation, the above calls will end up with a `cache` like this:

    {
        add: ['class1', 'class1'],
        remove: ['class1']
    }

which will lead to a `map` like this: `{class1: 1}` (thus adding/not removing the class).

Is this the intended behaviour ?