From e1aa6b44b65dd07c81c4e7bc36cb0b28f5ecec0f Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Tue, 16 Jun 2009 02:52:36 +0000 Subject: [PATCH] Fix Issue 22: remove empty attributes, add EOL for serialization git-svn-id: http://svg-edit.googlecode.com/svn/trunk@130 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 51dc3709..3d95afe2 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -94,10 +94,12 @@ function SvgCanvas(c) out += "<" + elem.nodeName; for (i=attrs.length-1; i>=0; i--) { attr = attrs.item(i); - out += " " + attr.nodeName + "=\"" + attr.nodeValue+ "\""; + if (attr.nodeValue != "") { + out += " " + attr.nodeName + "=\"" + attr.nodeValue+ "\""; + } } if (elem.hasChildNodes()) { - out += ">"; + out += ">\n"; indent++; for (i=0; i"; + out += "\n"; } else { - out += " />"; + out += " />\n"; } } return out; @@ -565,8 +567,8 @@ function SvgCanvas(c) this.save = function() { // remove the selected outline before serializing this.selectNone(); - var str = "" - str += ""; + var str = "\n"; + str += "\n"; str += svgToString(svgroot, 0); this.saveHandler(str); }