Fix for issue #311, mermaid will clear div used for rendering initially in the redner function.

This commit is contained in:
Knut Sveidqvist
2016-12-14 12:41:12 +01:00
parent a179212c60
commit 046b4fdae4
3 changed files with 17 additions and 31 deletions

View File

@@ -346,8 +346,6 @@ exports.decodeEntities = function(text){
return ';';
});
return txt;
};
/**
@@ -376,6 +374,8 @@ exports.decodeEntities = function(text){
var render = function(id, txt, cb, container){
if(typeof container !== 'undefined'){
container.innerHTML = '';
d3.select(container).append('div')
.attr('id', 'd'+id)
.append('svg')
@@ -385,6 +385,11 @@ var render = function(id, txt, cb, container){
.append('g');
}
else{
var element = document.querySelector('#' + 'd'+id);
if(element){
element.innerHTML = '';
}
d3.select('body').append('div')
.attr('id', 'd'+id)
.append('svg')