From 89641094de6be7f83ff089fe8ef383e69adcc45b Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 12 Jan 2011 06:51:34 +0000 Subject: [PATCH] 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 --- editor/svgcanvas.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 3455099c..a5b45b71 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -6422,17 +6422,20 @@ var uniquifyElems = this.uniquifyElems = function(g) { if(href && ref_elems.indexOf(n.nodeName) >= 0) { var refid = href.substr(1); - if (!(refid in ids)) { - // add this id to our map - ids[refid] = {elem:null, attrs:[], hrefs:[]}; + if (refid) { + if (!(refid in ids)) { + // add this id to our map + ids[refid] = {elem:null, attrs:[], hrefs:[]}; + } + 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 for (var oldid in ids) { + if (!oldid) continue; var elem = ids[oldid]["elem"]; if (elem) { var newid = getNextId();