From 65bae07fc142e517aa3f8d06a262de2e296b369c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 29 Jan 2021 15:41:11 +0100 Subject: [PATCH] Repair dumb logic bugs introduced during port to TypeScript --- packages/html/src/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/html/src/index.ts b/packages/html/src/index.ts index 86b9b56..ddd22e1 100644 --- a/packages/html/src/index.ts +++ b/packages/html/src/index.ts @@ -176,10 +176,8 @@ function spawnUIFragmentFactory(thisFacet: Facet) { let insertionPoint = findInsertionPoint(anchorNode, orderBy, fragmentId); while (true) { let n = insertionPoint ? insertionPoint.previousSibling : anchorNode.lastChild; - if (n && hasSortKey(n, orderBy, fragmentId)) { - // auto-updates previousSibling/lastChild - n.parentNode?.removeChild(n); - } + if (!(n && hasSortKey(n, orderBy, fragmentId))) break; + n.parentNode?.removeChild(n); // auto-updates previousSibling/lastChild } }); } @@ -206,8 +204,7 @@ function spawnUIFragmentFactory(thisFacet: Facet) { let insertionPoint = findInsertionPoint(anchorNode, orderBy, fragmentId); while (true) { let uiNode = insertionPoint ? insertionPoint.previousSibling : anchorNode.lastChild; - if (uiNode === null) break; - if (!hasSortKey(uiNode, orderBy, fragmentId)) break; + if (!(uiNode && hasSortKey(uiNode, orderBy, fragmentId))) break; if (isQueryableNode(uiNode)) { selectorMatch(uiNode, selector).forEach( eventUpdater(cleanEventType(eventType), handlerClosure, install));