fix(svg-export): correctly serialize svg 1.1

Closes #68
This commit is contained in:
Nico Rehwaldt 2014-05-28 12:19:35 +02:00
parent 14850f753f
commit 698167783b
2 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,7 @@ function getSvgContents(diagram) {
var outerNode = paper.node.parentNode;
var svg = outerNode.innerHTML;
return svg.replace(/^<svg[^>]>|<\/svg>$/, '');
return svg.replace(/^<svg[^>]*>|<\/svg>$/g, '');
}
function initListeners(diagram, listeners) {
@ -123,9 +123,8 @@ Viewer.prototype.saveXML = function(options, done) {
var SVG_HEADER =
'<?xml version="1.0" encoding="utf-8"?>\n' +
'<!-- created with bpmn-js / http://bpmn.io -->\n' +
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">\n' +
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' +
'version="1.1" baseProfile="basic">\n';
'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' +
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">\n';
var SVG_FOOTER = '</svg>';

View File

@ -107,6 +107,9 @@ describe('Viewer', function() {
// ensure correct rendering of SVG contents
expect(svg.indexOf('undefined')).toBe(-1);
// expect header to be written only once
expect(svg.indexOf('<svg width="100%" height="100%">')).toBe(-1);
done();
});
});