Skip to content

Commit

Permalink
append to the dom, not a document fragment, when updating each block …
Browse files Browse the repository at this point in the history
…in slot - fixes #927
  • Loading branch information
Rich-Harris committed Nov 23, 2017
1 parent 5f84375 commit 2f86266
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/generators/dom/visitors/EachBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function visitEachBlock(
const iterations = block.getUniqueName(`${each}_blocks`);
const params = block.params.join(', ');

const needsAnchor = node.next ? !isDomNode(node.next, generator) : !state.parentNode;
const needsAnchor = node.next ? !isDomNode(node.next, generator) : !state.parentNode || !isDomNode(node.parent, generator);
const anchor = needsAnchor
? block.getUniqueName(`${each}_anchor`)
: (node.next && node.next.var) || 'null';
Expand Down Expand Up @@ -219,7 +219,7 @@ function keyed(
`);

const dynamic = node._block.hasUpdateMethod;
const parentNode = state.parentNode || `${anchor}.parentNode`;
const parentNode = isDomNode(node.parent, generator) ? node.parent.var : `${anchor}.parentNode`;

let destroy;
if (node._block.hasOutroMethod) {
Expand Down Expand Up @@ -414,7 +414,7 @@ function unkeyed(
.map(dependency => `changed.${dependency}`)
.join(' || ');

const parentNode = state.parentNode || `${anchor}.parentNode`;
const parentNode = isDomNode(node.parent, generator) ? node.parent.var : `${anchor}.parentNode`;

if (condition !== '') {
const forLoopBody = node._block.hasUpdateMethod
Expand Down

0 comments on commit 2f86266

Please sign in to comment.