Merge pull request #994 from edekadigital/bug-478

#478 API crashes on 2nd render() call
This commit is contained in:
Knut Sveidqvist
2019-10-15 19:40:29 +02:00
committed by GitHub
3 changed files with 53 additions and 0 deletions

View File

@@ -463,6 +463,10 @@ const render = function(id, txt, cb, container) {
.attr('xmlns', 'http://www.w3.org/2000/svg')
.append('g');
} else {
const existingSvg = document.getElementById(id);
if (existingSvg) {
existingSvg.remove();
}
const element = document.querySelector('#' + 'd' + id);
if (element) {
element.innerHTML = '';