Fix Bug 751: Importing was not successfully ID'ing elements

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1903 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2011-01-12 06:51:34 +00:00
parent 53962cabb8
commit 89641094de
1 changed files with 7 additions and 4 deletions

View File

@ -6422,6 +6422,7 @@ var uniquifyElems = this.uniquifyElems = function(g) {
if(href && ref_elems.indexOf(n.nodeName) >= 0) if(href && ref_elems.indexOf(n.nodeName) >= 0)
{ {
var refid = href.substr(1); var refid = href.substr(1);
if (refid) {
if (!(refid in ids)) { if (!(refid in ids)) {
// add this id to our map // add this id to our map
ids[refid] = {elem:null, attrs:[], hrefs:[]}; ids[refid] = {elem:null, attrs:[], hrefs:[]};
@ -6429,10 +6430,12 @@ var uniquifyElems = this.uniquifyElems = function(g) {
ids[refid]["hrefs"].push(n); ids[refid]["hrefs"].push(n);
} }
} }
}
}); });
// in ids, we now have a map of ids, elements and attributes, let's re-identify // in ids, we now have a map of ids, elements and attributes, let's re-identify
for (var oldid in ids) { for (var oldid in ids) {
if (!oldid) continue;
var elem = ids[oldid]["elem"]; var elem = ids[oldid]["elem"];
if (elem) { if (elem) {
var newid = getNextId(); var newid = getNextId();