Skip to content

Commit edaeb87

Browse files
SlicedParentNode takes care of this for us now.
1 parent 8088422 commit edaeb87

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/idiomorph.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,6 @@ var Idiomorph = (function () {
187187
*/
188188
function morphOuterHTML(ctx, oldNode, newNode) {
189189
const oldParent = normalizeParent(oldNode);
190-
191-
// basis for calulating which nodes were morphed
192-
// since there may be unmorphed sibling nodes
193-
let childNodes = Array.from(oldParent.childNodes);
194-
const index = childNodes.indexOf(oldNode);
195-
// how many elements are to the right of the oldNode
196-
const rightMargin = childNodes.length - (index + 1);
197-
198190
morphChildren(
199191
ctx,
200192
oldParent,
@@ -203,10 +195,8 @@ var Idiomorph = (function () {
203195
oldNode, // start point for iteration
204196
oldNode.nextSibling, // end point for iteration
205197
);
206-
207-
// return just the morphed nodes
208-
childNodes = Array.from(oldParent.childNodes);
209-
return childNodes.slice(index, childNodes.length - rightMargin);
198+
// this is safe even with siblings, because normalizeParent returns a SlicedParentNode if needed.
199+
return Array.from(oldParent.childNodes);
210200
}
211201

212202
/**

0 commit comments

Comments
 (0)