#478 API crashes on 2nd render() call

- remove element from DOM before rendering to avoid conflicts in case of rerendering
This commit is contained in:
Kolja Markwardt
2019-10-15 08:02:41 +02:00
parent 74c171b6d1
commit 069b4854f8

View File

@@ -462,6 +462,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 = '';