Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mermaid doesn't delete nodes when called multiple times #491

Closed
ghost opened this issue Mar 13, 2017 · 1 comment
Closed

Mermaid doesn't delete nodes when called multiple times #491

ghost opened this issue Mar 13, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 13, 2017

Codes used (Typescript, just change let by var):

  let holder = document.getElementById('mermaidHolder');
  while (holder.firstChild) {
    holder.removeChild(holder.firstChild);
  }
  
  let node = document.createElement('div');
  node.className = 'mermaid';
  node.appendChild(document.createTextNode('My mermaid string'));
  holder.appendChild(node);
  mermaid.init();

When you call that the first time, all goes well.

If you don't change your mermaid string, all goes well.

But If you change your mermaid string, then the graph displays your older nodes, without the links.

If you change it again, the new nodes are appended to the existing ones.

If you change it again and take the first value back, then the nodes stay and the links are applied to your first value.

@ghost
Copy link
Author

ghost commented Mar 13, 2017

I'm sorry, it was a problem on my side.

I'm closing this, there's no error.

@ghost ghost closed this as completed Mar 13, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants