From c588d0d74deaf19fa3878f2a7348e314c958a188 Mon Sep 17 00:00:00 2001 From: Jeff Schiller Date: Tue, 29 Sep 2009 17:01:28 +0000 Subject: [PATCH] Issue 118: Fixed problem when selectorParentGroup hangs around after clearing the document git-svn-id: http://svg-edit.googlecode.com/svn/trunk@730 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 01aadc3f..25daf798 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -444,10 +444,14 @@ function BatchCommand(text) { var mgr = this; this.initGroup = function() { - mgr.selectorParentGroup = addSvgElementFromJson({ - "element": "g", - "attr": {"id": "selectorParentGroup"} - }); + // remove old selector parent group if it existed + if (mgr.selectorParentGroup && mgr.selectorParentGroup.parentNode) { + mgr.selectorParentGroup.parentNode.removeChild(mgr.selectorParentGroup); + } + // create parent selector group and add it to svgroot + mgr.selectorParentGroup = svgdoc.createElementNS(svgns, "g"); + mgr.selectorParentGroup.setAttribute("id", "selectorParentGroup"); + svgroot.appendChild(mgr.selectorParentGroup); mgr.selectorMap = {}; mgr.selectors = []; mgr.rubberBandBox = null;