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

Increase performance when checking if element is animatable #13784

Merged
merged 2 commits into from
Jan 19, 2016

Conversation

Narretz
Copy link
Contributor

@Narretz Narretz commented Jan 17, 2016

Built upon PR #13783

they('should not animate an element when the pinned element (which is the $prop element), is pinned to an element that is not a child of the $rootElement',
['same', 'parent', 'grandparent'],
function(elementRelation) {
inject(function($animate, $compile, $document, $rootElement, $rootScope) {
Copy link
Member

Choose a reason for hiding this comment

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

$compile is not used.
(Yes, in other tests too 😃)

@Narretz Narretz force-pushed the perf-animate-check branch from 47222c9 to d2e3790 Compare January 18, 2016 14:38
@Narretz
Copy link
Contributor Author

Narretz commented Jan 18, 2016

@gkalpak I've reverted the change, and recursive pinning is now allowed again. We can always change that later. And I've found and fixed another bug with the host element detection. Can you please review again?

@Narretz Narretz force-pushed the perf-animate-check branch from d2e3790 to 5068ca1 Compare January 18, 2016 15:00
they('should not animate an element when the pinned element (which is the $prop element), is pinned to an element that is not a child of the $rootElement',
['same', 'parent', 'grandparent'],
function(elementRelation) {
inject(function($animate, $compile, $document, $rootElement, $rootScope) {
Copy link
Member

Choose a reason for hiding this comment

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

$compile is not used (here and below).

@Narretz Narretz force-pushed the perf-animate-check branch from 5068ca1 to 729733b Compare January 18, 2016 15:27
@Narretz
Copy link
Contributor Author

Narretz commented Jan 18, 2016

@gkalpak Thanks for the review. Should be all good now.

@gkalpak
Copy link
Member

gkalpak commented Jan 19, 2016

LGTM 😃

This commit fixes two bugs:
1) Previously, animate would assume that a found host element
was part of the $rootElement (while it's possible that it is also outside the root).

2) Previously, if a parent of the animated element was pinned to a host element, the
host would not be checked regarding animations enabled status etc.

Closes angular#13783
This commit speeds up the code that checks if an element can
be animated, for the following two cases:

The checks will be sped up in cases where the animation
is disabled via $animate.enabled(element, false) on any parent element.

A minor speed-up is also included for cases where the $rootElement of the
app (the bootstrap element) is on the body or lower in the DOM tree.
@Narretz Narretz force-pushed the perf-animate-check branch from 729733b to 683bd92 Compare January 19, 2016 12:14
@Narretz Narretz merged commit 683bd92 into angular:master Jan 19, 2016
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.

3 participants