Skip to content

Commit

Permalink
Further simplify placeChild with newly unnecessary conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Oct 26, 2023
1 parent 74e603e commit e3378e0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/diff/children.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,8 @@ export function toChildArray(children, out) {
}

function placeChild(parentDom, newDom, oldDom) {
// TODO: How do we enter here when oldDom isn't in parentDom? We should fix
// that such that it never happens. Changing `oldDom.parentNode !== parentDom`
// to `!oldDom.isConnected` also passes our test suite.
if (oldDom == null || oldDom.parentNode !== parentDom) {
parentDom.insertBefore(newDom, null);
} else if (newDom != oldDom) {
parentDom.insertBefore(newDom, oldDom);
if (newDom != oldDom) {
parentDom.insertBefore(newDom, oldDom || null);
}

return newDom.nextSibling;
Expand Down

0 comments on commit e3378e0

Please sign in to comment.