Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 27d4a4f

Browse files
committed
chore(ngRepeat): improve inline comments
1 parent 5cec461 commit 27d4a4f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ng/directive/ngRepeat.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
305305
//watch props
306306
$scope.$watchCollection(rhs, function ngRepeatAction(collection) {
307307
var index, length,
308-
previousNode = $element[0], // current position of the node
308+
previousNode = $element[0], // node that cloned nodes should be inserted after
309+
// initialized to the comment node anchor
309310
nextNode,
310311
// Same as lastBlockMap but it has the current state. It will become the
311312
// lastBlockMap on the next iteration.
@@ -391,7 +392,10 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) {
391392
if (block.scope) {
392393
// if we have already seen this object, then we need to reuse the
393394
// associated scope/element
395+
394396
nextNode = previousNode;
397+
398+
// skip nodes that are already pending removal via leave animation
395399
do {
396400
nextNode = nextNode.nextSibling;
397401
} while (nextNode && nextNode[NG_REMOVED]);

0 commit comments

Comments
 (0)