diff --git a/lib/OpenLayers/Renderer/Elements.js b/lib/OpenLayers/Renderer/Elements.js index 9ec048ce16..276af7f454 100644 --- a/lib/OpenLayers/Renderer/Elements.js +++ b/lib/OpenLayers/Renderer/Elements.js @@ -506,44 +506,34 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, { */ redrawNode: function(id, geometry, style, featureId) { // Get the node if it's already on the map. - var currentNode = OpenLayers.Util.getElement(id); - - // Create a new node, or use the current one if it's - // already there. - var newNode; - if (!currentNode) { - var nodeType = this.getNodeType(geometry, style); - newNode = this.createNode(nodeType, id); - } else { - newNode = currentNode; - } + var node = this.nodeFactory(id, this.getNodeType(geometry, style)); // Set the data for the node, then draw it. - newNode._featureId = featureId; - newNode._geometry = geometry; - newNode._geometryClass = geometry.CLASS_NAME; - newNode._style = style; + node._featureId = featureId; + node._geometry = geometry; + node._geometryClass = geometry.CLASS_NAME; + node._style = style; - var drawResult = this.drawGeometryNode(newNode, geometry, style); + var drawResult = this.drawGeometryNode(node, geometry, style); if(drawResult === false) { return false; } - newNode = drawResult.node; + node = drawResult.node; // Insert the node into the indexer so it can show us where to // 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(newNode) : null; + var insert = this.indexer ? this.indexer.insert(node) : null; if(insert) { - this.root.insertBefore(newNode, insert); + this.root.insertBefore(node, insert); } else { - this.root.appendChild(newNode); + this.root.appendChild(node); } - this.postDraw(newNode); + this.postDraw(node); return drawResult.complete; },