Remove from non-embedded SVGs
Change-Id: I7e7e6cd866ee86b28d04c3dfcee3d6dca3e1b262
diff --git a/dev/js/src/match/treehierarchy.js b/dev/js/src/match/treehierarchy.js
index 08ebeef..e9c6122 100644
--- a/dev/js/src/match/treehierarchy.js
+++ b/dev/js/src/match/treehierarchy.js
@@ -214,8 +214,8 @@
'g.leaf > rect ' + '{ display: none }' +
'g > text > tspan ' + '{ text-anchor: middle; font-size: 9pt }' +
'g.leaf > text > tspan ' + '{ font-size: 10pt; overflow: visible; }';
-
- return btoa(unescape(encodeURIComponent(svg.outerHTML)));
+
+ return btoa(unescape(encodeURIComponent(svg.outerHTML)).replace(/ /g, ' '));
},
/**
@@ -279,11 +279,16 @@
'transform',
'translate(' + v.width/2 + ',' + ((v.height / 2) + 5) + ')'
);
+
+ var vLabel = v.label.replace(/ /g, " ")
+ .replace(/&/g, '&')
+ .replace(/</g, '<')
+ .replace(/>/g, '>');
if (v.class === "leaf") {
- text.setAttribute('title', v.label);
+ text.setAttribute('title', vLabel);
- var labelPart = v.label.split(" ");
+ var labelPart = vLabel.split(" ");
var n = 0;
for (var i = 0; i < labelPart.length; i++) {
if (labelPart[i].length === 0)
@@ -308,7 +313,7 @@
}
else {
var tspan = that._c('tspan');
- tspan.appendChild(d.createTextNode(v.label));
+ tspan.appendChild(d.createTextNode(vLabel));
tspan.setAttribute('x', v.x - v.width / 2);
text.appendChild(tspan);
};