Skip to content

Commit

Permalink
fix #1
Browse files Browse the repository at this point in the history
  • Loading branch information
sandorfr committed Feb 13, 2018
1 parent 2063505 commit 1cdc76b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions graphviz-render.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
function contentLoaded() {
var graphvizElements = document.getElementsByClassName('graphviz');

var changes = [];

for (let index = 0; index < graphvizElements.length; index++) {
const element = graphvizElements.item(index);
var element = graphvizElements.item(index);
var source = element.textContent;
element.parentElement.parentElement.outerHTML = Viz(source);

changes.push({
placeholder: element.parentElement.parentElement,
svg: Viz(source)
});
}

for (let index = 0; index < changes.length; index++) {
const element = changes[index];
element.placeholder.outerHTML = element.svg;
}

// use to debug rendered code.
Expand Down

0 comments on commit 1cdc76b

Please sign in to comment.