Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
/angular.jsPublic archive

perf(ngAnimate): cache repeated calls to addClass/removeClass#14166

Closed

Conversation

matsko
Copy link
Contributor

Applies to 1.4.x and 1.5.x and master

Closes#14165
Closes#14166

@matskomatskoforce-pushed thefix_ng_animate_caching branch frome58c06b to4745a0dCompareMarch 3, 2016 01:20
matsko added a commit to matsko/angular.js that referenced this pull requestMar 3, 2016
@matsko
Copy link
ContributorAuthor

Don't merge this yet. There's a cache issue.

@matskomatskoforce-pushed thefix_ng_animate_caching branch from4745a0d to0f15476CompareMarch 3, 2016 05:32
matsko added a commit to matsko/angular.js that referenced this pull requestMar 3, 2016
@matsko
Copy link
ContributorAuthor

OK now it's fixed.

@matskomatskoforce-pushed thefix_ng_animate_caching branch from0f15476 to1d766cfCompareMarch 3, 2016 05:42
@Narretz
Copy link
Contributor

Wow that's a ton of changes. I'll try to review today. However could you update the commit message with an explanation of the issue and the fix?

from: {background: 'red' },
to: {background: 'blue', 'font-size': '50px' }
from: {height: '100px' },
to: {height: '200px', 'font-size': '50px' }
Copy link
Contributor

Choose a reason for hiding this comment

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

@matsko why change these styles? It seems arbitrary.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

When the element is attached to a parent element then the colors are actually applied and getComputedStyle (which is what element.css in jQuery uses) actually figures out what the color is. Beforehand it was just using the inline style. Since we now deal with actually getting the RGB value for the color it was easier just to use a more stable value like a height measurement value.

@Narretz
Copy link
Contributor

Oh and@matsko can you add a demo that shows the speed up that this introduces?

@Narretz
Copy link
Contributor

Here's a plnkr to test the performance:http://plnkr.co/edit/bnaaaHbWkyQULeoOOg2X?p=preview

There's a simple ngRepeat that an ngClass on it. In my tests, ng animate with this test is about 30% faster.

However, if you include the<input> in the ngIf, the performance becomes pretty atrocious with both versions. There seems to be another problem there.

Regarding animating nth-child(x) elements in a repeater, that doesn't seem to work anyway:http://plnkr.co/edit/klCK5E22YPJ9Zfbz2meF?p=preview

Narretz pushed a commit to Narretz/angular.js that referenced this pull requestMay 18, 2018
…imation has no durationBackground:ngAnimate writes helper classes to DOM elements to see if animations are defined on them. If manyelements have the same definition, we can cache the definition and skip the application of thehelper classes altogether. This helps particularly with large ngRepeat collections.Closesangular#14165Closesangular#14166
Narretz pushed a commit to Narretz/angular.js that referenced this pull requestJun 25, 2018
…imation has no durationBackground:ngAnimate writes helper classes to DOM elements to see if animations are defined on them. If manyelements have the same definition, we can cache the definition and skip the application of thehelper classes altogether. This helps particularly with large ngRepeat collections.Closesangular#14165Closesangular#14166
Narretz pushed a commit to Narretz/angular.js that referenced this pull requestJul 3, 2018
…imation has no durationBackground:ngAnimate writes helper classes to DOM elements to see if animations are defined on them. If manyelements have the same definition, we can cache the definition and skip the application of thehelper classes altogether. This helps particularly with large ngRepeat collections.Closesangular#14165Closesangular#14166
Narretz pushed a commit to Narretz/angular.js that referenced this pull requestJul 4, 2018
…imation has no durationBackground:ngAnimate writes helper classes to DOM elements to see if animations are defined on them. If manyelements have the same definition, we can cache the definition and skip the application of thehelper classes altogether. This helps particularly with large ngRepeat collections.Closesangular#14165Closesangular#14166
Narretz pushed a commit that referenced this pull requestJul 5, 2018
…imation has no durationBackground:ngAnimate writes helper classes to DOM elements to see if animations are defined on them. If manyelements have the same definition, and the same parent, we can cache the definition and skip theapplication of the helper classes altogether. This helps particularly with large ngRepeatcollections.Closes#14165Closes#14166Closes#16613
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees

@matskomatsko

@NarretzNarretz

Projects
None yet
Milestone
1.7.x
Development

Successfully merging this pull request may close these issues.

4 participants
@matsko@Narretz@petebacondarwin@googlebot

[8]ページ先頭

©2009-2025 Movatter.jp