Skip to content

Commit

Permalink
Extended AfterAdd/BeforeRemove callbacks to pass on more information
Browse files Browse the repository at this point in the history
  • Loading branch information
sagacity committed Oct 20, 2010
1 parent a2e4c7c commit cfd8c57
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/binding/editDetection/arrayToDomNodeChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@
case "deleted":
// Queue these nodes for later removal
ko.utils.arrayForEach(lastMappingResult[lastMappingResultIndex].domNodes, function (node) {
nodesToDelete.push(node);
nodesToDelete.push({
element: node,
index: i,
value: editScript[i].value
});
insertAfterNode = node;
});
lastMappingResultIndex++;
Expand All @@ -67,7 +71,11 @@
newMappingResult.push({ arrayEntry: editScript[i].value, domNodes: mappedNodes });
for (var nodeIndex = 0, nodeIndexMax = mappedNodes.length; nodeIndex < nodeIndexMax; nodeIndex++) {
var node = mappedNodes[nodeIndex];
nodesAdded.push(node);
nodesAdded.push({
element: node,
index: i,
value: editScript[i].value
});
if (insertAfterNode == null) {
// Insert at beginning
if (domNode.firstChild)
Expand Down

0 comments on commit cfd8c57

Please sign in to comment.