You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Surplus.content directly to manipulate the content of an element not created or controlled by the Surplus compiler. But the same error can be reproduced with JSX syntax. The following snippet reproduces the error.
import*asSurplusfrom"surplus";consta=["foo ",span("["),"bar",span("]")];constb=["foo ",span("{"),"bar",span("}")];letstate=[];constbody=document.createElement("div");state=Surplus.content(body,a,state);state=Surplus.content(body,b,state);// Failed to execute 'insertBefore' on 'Node': // The node before which the new node is to be // inserted is not a child of this node.// utilityfunctionspan(s: string){constspan=document.createElement("span");span.innerText=s;returnspan;}
The exception is thrown from https://github.com/adamhaile/surplus/blob/master/src/runtime/content.ts#L302. It appears that inserting the right-most <span>}</span> is skipped, due to being marked as NOINSERT. Then, when going to insert the Text node "bar", it attempts to insert relative to the <span> which was not inserted.
I'm not sure why the right-most <span> is marked as NOINSERT by this line in the text node reuse algorithm. Is it failing to mark the "bar" node and mis-marking the <span> node?
The text was updated successfully, but these errors were encountered:
I am using
Surplus.content
directly to manipulate the content of an element not created or controlled by the Surplus compiler. But the same error can be reproduced with JSX syntax. The following snippet reproduces the error.The exception is thrown from https://github.com/adamhaile/surplus/blob/master/src/runtime/content.ts#L302. It appears that inserting the right-most
<span>}</span>
is skipped, due to being marked asNOINSERT
. Then, when going to insert the Text node"bar"
, it attempts to insert relative to the<span>
which was not inserted.I'm not sure why the right-most
<span>
is marked asNOINSERT
by this line in the text node reuse algorithm. Is it failing to mark the"bar"
node and mis-marking the<span>
node?The text was updated successfully, but these errors were encountered: