fix a bug in svgToString function:

some elements have no attribute, so when convert it to stinrg some namespace can't be set correctly.

now, the tag like this can be correctly converted:
<se:mytag>hello</se:mytag>

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2517 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
薄成文 2013-06-08 05:29:14 +00:00
parent 7b986e56ef
commit 089f061641
1 changed files with 7 additions and 0 deletions

View File

@ -4120,6 +4120,13 @@ this.svgToString = function(elem, indent) {
// Check elements for namespaces, add if found
$(elem).find('*').andSelf().each(function() {
var el = this;
// for some elements have no attribute
var uri = this.namespaceURI;
if(uri && !nsuris[uri] && nsMap[uri] && nsMap[uri] !== 'xmlns' && nsMap[uri] !== 'xml' ) {
nsuris[uri] = true;
out.push(" xmlns:" + nsMap[uri] + '="' + uri +'"');
}
$.each(this.attributes, function(i, attr) {
var uri = attr.namespaceURI;
if (uri && !nsuris[uri] && nsMap[uri] !== 'xmlns' && nsMap[uri] !== 'xml' ) {