From d6037a742e7f7213ca094994156e3218b88046c4 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Tue, 16 Feb 2010 18:32:50 +0000 Subject: [PATCH] When serializing, use nodename (which includes namespace prefix). Patch by Jacques Distler git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1393 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 87acb284..e0f8d259 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -1514,14 +1514,10 @@ function BatchCommand(text) { $.inArray(attr.localName, ['width','height','xmlns','x','y','viewBox','id','overflow']) == -1) { out.push(' '); - // map various namespaces to our fixed namespace prefixes - // (the default xmlns attribute itself does not get a prefix) - if(attr.namespaceURI) { - out.push(nsMap[attr.namespaceURI]+':'); + if(!attr.namespaceURI || nsMap[attr.namespaceURI]) { + out.push(attr.nodeName); out.push("=\""); + out.push(attrVal); out.push("\""); } - - out.push(attr.localName); out.push("=\""); - out.push(attrVal); out.push("\""); } } } else { @@ -1543,19 +1539,18 @@ function BatchCommand(text) { && elem.nodeName == 'image' && attr.localName == 'href' && save_options.images - && save_options.images == 'embed') { + && save_options.images == 'embed') + { var img = encodableImages[attrVal]; if(img) attrVal = img; } // map various namespaces to our fixed namespace prefixes // (the default xmlns attribute itself does not get a prefix) - if(attr.namespaceURI && attr.localName != "xmlns") { - out.push(nsMap[attr.namespaceURI]+':'); + if(!attr.namespaceURI || nsMap[attr.namespaceURI]) { + out.push(attr.nodeName); out.push("=\""); + out.push(attrVal); out.push("\""); } - - out.push(attr.localName); out.push("=\""); - out.push(attrVal); out.push("\""); } } }