Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngAnimate): ensure nested class-based animations are spaced out with a RAF #11907

Closed
wants to merge 1 commit into from

Conversation

matsko
Copy link
Contributor

@matsko matsko commented May 20, 2015

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes #11812

@matsko matsko force-pushed the raf_ng_class_schedule branch 2 times, most recently from 87acec9 to e5e1ec1 Compare May 20, 2015 00:22
@matsko matsko changed the title fix(ngAnimate): ensure nested class-based animations spaced out with a RAF fix(ngAnimate): ensure nested class-based animations are spaced out with a RAF May 20, 2015
@matsko matsko force-pushed the raf_ng_class_schedule branch from e5e1ec1 to 4d2a1a8 Compare May 20, 2015 00:37
@@ -53,12 +57,18 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
options.tempClasses = null;
}

var classBasedIndex;
if (!isStructural) {
classBasedIndex = totalPendingClassBasedAnimations++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite lack of brevity I think it is safer to make this explicit:

classBasedIndex = totalPendingClassBasedAnimations;
totalPendingClassBasedAnimations += 1;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

The ++ syntax looks a little magical, it's easy to make a mistake.

@petebacondarwin
Copy link
Contributor

$$rAFScheduler has no tests...

@mgol
Copy link
Member

mgol commented May 20, 2015

I confirm it does fix the real issue in my app that I reduced to #11812 👍

@matsko
Copy link
Contributor Author

matsko commented May 21, 2015

@petebacondarwin yes we need tests for it. I'll do those in the morning tomorrow.

…ith a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
@matsko matsko force-pushed the raf_ng_class_schedule branch from 4d2a1a8 to 2da33f6 Compare May 21, 2015 17:46
@matsko
Copy link
Contributor Author

matsko commented May 21, 2015

@petebacondarwin @mzgol the code has been fixed and the tests have been added.

@matsko
Copy link
Contributor Author

matsko commented May 21, 2015

Merged as 213c2a7

@matsko matsko closed this May 21, 2015
@matsko matsko deleted the raf_ng_class_schedule branch May 21, 2015 21:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested ng-class breaks ngAnimate in Angular 1.4.0-rc.1
5 participants