Fix for defect #180, SVG foreignObject rendering

This commit is contained in:
knsv
2015-10-04 21:18:05 +02:00
parent 122274bf52
commit 8258fb059c
9 changed files with 870 additions and 852 deletions

View File

@@ -282,7 +282,7 @@ exports.version = function(){
exports.encodeEntities = function(text){
var txt = text;
txt = txt.replace(/#\w*;?/g,function(s,t,u){
txt = txt.replace(/#\w+\;/g,function(s,t,u){
var innerTxt = s.substring(1,s.length-1);
var isInt = /^\+?\d+$/.test(innerTxt);
@@ -409,6 +409,10 @@ var render = function(id, txt, cb, container){
break;
}
d3.select('#d'+id).selectAll('foreignobject div').attr('xmlns','http://www.w3.org/1999/xhtml');
// Fix for when the base tag is used
var svgCode = d3.select('#d'+id).node().innerHTML.replace(/url\(#arrowhead/g,'url('+ window.location.protocol+'//'+location.host+location.pathname +'#arrowhead','g');