Fix Issue 482: Correct namespace prefix handling. Foreign content itself will declare the namespace, we don't need to do this in svgcontent
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1389 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
c32284cfcb
commit
88d61a3259
|
@ -917,7 +917,7 @@ function BatchCommand(text) {
|
||||||
var canvas = this,
|
var canvas = this,
|
||||||
svgns = "http://www.w3.org/2000/svg",
|
svgns = "http://www.w3.org/2000/svg",
|
||||||
xlinkns = "http://www.w3.org/1999/xlink",
|
xlinkns = "http://www.w3.org/1999/xlink",
|
||||||
xmlns = "http://www.w3.org/XML/1998/namespace",
|
xmlns = "http://www.w3.org/2000/xmlns/", // see http://www.w3.org/TR/REC-xml-names/#xmlReserved
|
||||||
se_ns = "http://svg-edit.googlecode.com",
|
se_ns = "http://svg-edit.googlecode.com",
|
||||||
htmlns = "http://www.w3.org/1999/xhtml",
|
htmlns = "http://www.w3.org/1999/xhtml",
|
||||||
mathns = "http://www.w3.org/1998/Math/MathML",
|
mathns = "http://www.w3.org/1998/Math/MathML",
|
||||||
|
@ -1497,22 +1497,7 @@ function BatchCommand(text) {
|
||||||
if(elem.id == 'svgcontent') {
|
if(elem.id == 'svgcontent') {
|
||||||
// Process root element separately
|
// Process root element separately
|
||||||
var res = canvas.getResolution();
|
var res = canvas.getResolution();
|
||||||
out.push(' width="' + res.w + '" height="' + res.h + '" xmlns="'+svgns+'"');
|
out.push(' width="' + res.w + '" height="' + res.h + '" xmlns="'+svgns+'" xmlns:xlink="'+xlinkns+'"');
|
||||||
|
|
||||||
var nsuris = {};
|
|
||||||
|
|
||||||
// Check elements for namespaces, add if found
|
|
||||||
$(elem).find('*').each(function() {
|
|
||||||
var el = this;
|
|
||||||
$.each(this.attributes, function(i, attr) {
|
|
||||||
var uri = attr.namespaceURI;
|
|
||||||
if(uri && !nsuris[uri]) {
|
|
||||||
nsuris[uri] = true;
|
|
||||||
out.push(" xmlns:" + nsMap[uri] + '="' + uri +'"');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (var i=attrs.length-1; i>=0; i--) {
|
for (var i=attrs.length-1; i>=0; i--) {
|
||||||
attr = attrs.item(i);
|
attr = attrs.item(i);
|
||||||
|
@ -1538,7 +1523,8 @@ function BatchCommand(text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// map various namespaces to our fixed namespace prefixes
|
// map various namespaces to our fixed namespace prefixes
|
||||||
if(attr.namespaceURI) {
|
// (the default xmlns attribute itself does not get a prefix)
|
||||||
|
if(attr.namespaceURI && nsMap[attr.namespaceURI] != "xmlns") {
|
||||||
out.push(nsMap[attr.namespaceURI]+':');
|
out.push(nsMap[attr.namespaceURI]+':');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue