-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Directive: working with html fragment in documentFragment instead of direct modifying DOM #13423
Comments
… them During parent structural animations, ongoing animations on child elements are closed. These children are looked up by checking the data-ng-animate attribute. If an element is the clone of an animating element, it might have this attribute, but no animation runner associated with it, so we need to ignore it. Fixes angular#11992 Closes angular#13423
Sounds interesting, but I can't currently see what use case or problem would this approach solve. Can you give an example where the current behavior is not sufficient? |
Now i have large app on angular, and first render totally blocks page. It happens, because when directive inserting template inside element, it makes:
And if one of the basic directive has a lot of attachments, it becomes very heavy-to-parse. |
We've seen reports about this, and in most cases it's because apps load many different templates via XHR. Have you tried caching the templates in a build-step? Does that improve the performance? It's also not completely obvious to me that documentFragments would improve performance. |
Ignore that. Sry. |
I'm also curious about this. I'm going to see if I can get anywhere myself, but I have the same problem.. A larger app taking a while to render. I suspect that if it was easy to do, though, the angular team would have already done it. |
There's not really enough substance in this issue to keep it open. A PoC that uses documentFragment would be required to gauge the benefit of this approach. There's also the problem as of how Angular should determine when to use a documentFragment and when to parse the DOM directly. So a PR with a PoC is welcome, but otherwise this discussion isn't very fruitful. |
I am very disappointed with the behavior of the angular when it works in a DOM tree.
It inserts and parses directives directly in the HTML, but does not use documentFragment.
Why it can't make something like this?
Directive => inserting innerHTML into documentFragment => doing usual things with it => finding inner directives => parse them => repeat, until all directives into this fragment will be resolved => insert ready-to-use fragment into real tree.
I think, that must be a flag, because some peoples uses templateUrl without caching in production, so there will be a white screen for a log time.
Thanks!
The text was updated successfully, but these errors were encountered: