Fix serialization of xml:space attribute. Restore copying of text elements.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@814 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
79522f7434
commit
5771e91e13
|
@ -555,7 +555,7 @@ function BatchCommand(text) {
|
|||
var handle = svgroot.suspendRedraw(suspendLength);
|
||||
|
||||
for (i in attrs) {
|
||||
var ns = (i.substr(0,4) == "xml:" ? "http://www.w3.org/XML/1998/namespace" : null);
|
||||
var ns = (i.substr(0,4) == "xml:" ? xmlns : null);
|
||||
node.setAttributeNS(ns, i, attrs[i]);
|
||||
}
|
||||
|
||||
|
@ -611,6 +611,7 @@ function BatchCommand(text) {
|
|||
var container = c;
|
||||
var svgns = "http://www.w3.org/2000/svg";
|
||||
var xlinkns = "http://www.w3.org/1999/xlink";
|
||||
var xmlns = "http://www.w3.org/XML/1998/namespace";
|
||||
var idprefix = "svg_";
|
||||
var svgdoc = c.ownerDocument;
|
||||
var svgroot = svgdoc.createElementNS(svgns, "svg");
|
||||
|
@ -904,12 +905,15 @@ function BatchCommand(text) {
|
|||
out.push(" ");
|
||||
// map various namespaces to our fixed namespace prefixes
|
||||
// TODO: put this into a map and do a look-up instead of if-else
|
||||
if (attr.namespaceURI == 'http://www.w3.org/1999/xlink') {
|
||||
if (attr.namespaceURI == xlinkns) {
|
||||
out.push('xlink:');
|
||||
}
|
||||
else if(attr.namespaceURI == 'http://www.w3.org/2000/xmlns/' && attr.localName != 'xmlns') {
|
||||
out.push('xmlns:');
|
||||
}
|
||||
else if(attr.namespaceURI == xmlns) {
|
||||
out.push('xml:');
|
||||
}
|
||||
out.push(attr.localName); out.push("=\"");
|
||||
out.push(attr.nodeValue); out.push("\"");
|
||||
}
|
||||
|
@ -4538,7 +4542,8 @@ function BatchCommand(text) {
|
|||
// manually create a copy of the element
|
||||
var new_el = document.createElementNS(svgns, el.nodeName);
|
||||
$.each(el.attributes, function(i, attr) {
|
||||
var ns = attr.nodeName == 'href'?xlinkns:null;
|
||||
var ns = attr.nodeName == 'href' ? xlinkns :
|
||||
attr.prefix == "xml" ? xmlns : null;
|
||||
new_el.setAttributeNS(ns, attr.nodeName, attr.nodeValue);
|
||||
});
|
||||
// set the copied element's new id
|
||||
|
|
Loading…
Reference in New Issue