This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(jqLite): optimize element dealocation
Iterate only over elements and not nodes since we don't attach data or handlers to text/comment nodes.
- Loading branch information
e35abc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IgorMinar & @rodyhaddad - it is not enough to check adding data, we also create expandoStore data when attaching event handlers to nodes such as comment nodes.
It may be that jQuery doesn't allow adding events to comments either but then we have a problem to clear up element transclusion see #7913
e35abc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have used "children = element.childNodes" instead of "children = element.children"? When using that, the leak in #7913 doesn't occur.
e35abc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of the optimization was not to have to search all nodes, since the belief was that the previous commit no longer allowed data to be attached to non-elements. But this is not the case since we are still attaching event handlers to comment nodes, which also uses the cache.
e35abc9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Sorry for the noise...I'm just getting my head around angular.