From be82c1ef6e2ffa1bb6441175f9c1197f4c0b5197 Mon Sep 17 00:00:00 2001 From: pgiraud Date: Mon, 26 Jan 2009 14:54:16 +0000 Subject: [PATCH] don't re-append the geometry node if it is already there, a regression is fixed with this patch, r=ahocevar (Closes #1066) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8766 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Renderer/Elements.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Renderer/Elements.js b/lib/OpenLayers/Renderer/Elements.js index 04fd17a6f8..39eb4fa10f 100644 --- a/lib/OpenLayers/Renderer/Elements.js +++ b/lib/OpenLayers/Renderer/Elements.js @@ -525,12 +525,19 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, { // place it. Note that this operation is O(log(n)). If there's a // performance problem (when dragging, for instance) this is // likely where it would be. - var insert = this.indexer ? this.indexer.insert(node) : null; - - if(insert) { - this.root.insertBefore(node, insert); + if (this.indexer) { + var insert = this.indexer.insert(node); + if (insert) { + this.root.insertBefore(node, insert); + } else { + this.root.appendChild(node); + } } else { - this.root.appendChild(node); + // if there's no indexer, simply append the node to root, + // but only if the node is a new one + if (node.parentNode !== this.root){ + this.root.appendChild(node); + } } this.postDraw(node);