Suppose you have at least two nested switch statements in a .stache file (like {{#switch}}). If you somehow - usually by some kind of user input - switch between the cases of the nested, inner switch, the DOM gets mutated. But if the user then - again by clicking somewhere or so - switches between the cases of the outer switch, removeChild fails, because some DOM nodes of the inner switch are not anymore children of the outer switch.
The problem usually starts with a line like canBatch.stop();, e.g. in can-route, but this stop can also be called elsewhere, like in the fiddle below.
My current workaround is to wrap the inner switch in a <div>. The inner switch can also be an {{#if}}...{{else}}...{{/if}} by the way.
--> results: some text of the inner switch stays on the page and an error like this appears in the console: 'NotFoundError: Node was not found'. The error message depends on the context and probably on the browser.
I'm not sure, whether this the right repo for this issue, but the problem always ends up here.
Edit This is the method in question in mutate.js.
Suppose you have at least two nested switch statements in a .stache file (like
{{#switch}}
). If you somehow - usually by some kind of user input - switch between the cases of the nested, inner switch, the DOM gets mutated. But if the user then - again by clicking somewhere or so - switches between the cases of the outer switch,removeChild
fails, because some DOM nodes of the inner switch are not anymore children of the outer switch.The problem usually starts with a line like
canBatch.stop();
, e.g. in can-route, but thisstop
can also be called elsewhere, like in the fiddle below.My current workaround is to wrap the inner switch in a
<div>
. The inner switch can also be an{{#if}}...{{else}}...{{/if}}
by the way.Here is the demonstrating fiddle. Steps for reproducing the issue:
--> results: some text of the inner switch stays on the page and an error like this appears in the console: 'NotFoundError: Node was not found'. The error message depends on the context and probably on the browser.