Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Conversation

justinfagnani
Copy link

This adds a patchBetween(startNode, endNode, template, data) function that can run a patch function in between two nodes.

assertNoUnclosedTags(currentParent, endNode);
}
}
if (currentNode && currentNode.nextSibling !== endNode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to have unvisited dom but currentNode.nextSibling === endNode.

{template a}

{if $a}
{else} {/if}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you expand on that a bit? What would the unvisited DOM be? What are the idom opcode that produce it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be

function fn(a:boolean) {
elementOpen('div', 1);
elementClose();
if (a) {
elementOpen('div', 2);
elementClose();
} else {
elementOpen('div', 3);
elementClose();
}
elementOpen('div', 4);
elementClose();
}

In the first route (A), you'd have

if you flip a to false, you'd first have, I think, the following behavior

<-- insert

then the jump to 4

<-- insert
<--

and then never deleting [key=2]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants