diff --git a/lib/map/labellayer.js b/lib/map/labellayer.js
index a32ce9c..63ff62e 100644
--- a/lib/map/labellayer.js
+++ b/lib/map/labellayer.js
@@ -87,7 +87,7 @@ define(['leaflet', 'rbush', 'helper', 'moment'],
m.on('click', function () {
router.fullUrl({ node: d.node_id });
});
- m.bindTooltip(d.hostname);
+ m.bindTooltip(helper.escape(d.hostname));
dict[d.node_id] = m;
@@ -114,7 +114,7 @@ define(['leaflet', 'rbush', 'helper', 'moment'],
line.setStyle(opts);
};
- line.bindTooltip(d.source.hostname + ' – ' + d.target.hostname +
+ line.bindTooltip(helper.escape(d.source.hostname + ' – ' + d.target.hostname) +
'
' + helper.showDistance(d) + ' / ' + helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq) + '
' + d.type + '');
line.on('click', function () {
diff --git a/lib/utils/helper.js b/lib/utils/helper.js
index 429f4eb..41f7b1c 100644
--- a/lib/utils/helper.js
+++ b/lib/utils/helper.js
@@ -196,5 +196,11 @@ define({
btn.classList.add('ion-full-enter');
}
}
+ },
+ escape: function escape(string) {
+ return string.replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
}
});