From 53962cabb89b3147b60336642966f8e30265aeae Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Wed, 12 Jan 2011 06:07:28 +0000 Subject: [PATCH] Added symbol as an element that is referred to when uniquifying elements, added a TODO for connectors/markers git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1902 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 36670dd7..3455099c 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -6375,7 +6375,15 @@ this.randomizeIds = function() { // g - The parent element of the tree to give unique IDs var uniquifyElems = this.uniquifyElems = function(g) { var ids = {}; - var ref_elems = ["filter", "linearGradient", "pattern", "radialGradient", "textPath", "use"]; + // TODO: Handle markers and connectors. These are not yet re-identified properly + // as their referring elements do not get remapped. + // + // + // + // + // Problem #1: if svg_1 gets renamed, we do not update the polyline's se:connector attribute + // Problem #2: if the polyline svg_7 gets renamed, we do not update the marker id nor the polyline's marker-end attribute + var ref_elems = ["filter", "linearGradient", "pattern", "radialGradient", "symbol", "textPath", "use"]; svgedit.utilities.walkTree(g, function(n) { // if it's an element node @@ -6396,7 +6404,7 @@ var uniquifyElems = this.uniquifyElems = function(g) { var attrnode = n.getAttributeNode(attr); if (attrnode) { // the incoming file has been sanitized, so we should be able to safely just strip off the leading # - var url = getUrlFromAttr(attrnode.value), + var url = getUrlFromAttr(attrnode.value), refid = url ? url.substr(1) : null; if (refid) { if (!(refid in ids)) {