[OpenLayers-Dev] Re: root.parentNode is null for svg renderer

ray.diciaccio ray.diciaccio at ll.mit.edu
Thu Sep 23 18:54:27 EDT 2010


Came up with a solution and thought I'd share in case anyone ever has a
similar problem.
I had several controls using Vector.RootContainers. When switching controls
and layers, these RootContainers needed to be updated, so one was destroyed
and a new one constructed in its place. This resulted in some renderer root
nodes being left within RootContainer's container node, which was removed
from the DOM when the layer was destroyed. This caused the root.parentNode
to be null in these cases (as described below). To fix this I simply called
RootContainer.resetRoots() right before destroying the RootContainer, which
re-attached the renderer roots to their original containers and prevented
the parentNode from being null.


ray.diciaccio wrote:
> 
> Hi list,
> 
> I've made some extensive modifications/additions to the OpenLayers library
> to support our development here, but now I'm running into some issues with
> the SVG renderers. The problem seems to have something to do with the root
> node of a renderer becoming detached from the DOM, so that when 
> OpenLayers.Renderer.Elements.moveRoot() is called, it fails on:
> 	root.parentNode.removeChild(root);
> because root.parentNode is null.
> 
> I'm not manually removing this node at any point in my code, and I'm
> having a really difficult time tracking down where this occurs. Does
> anyone have any clues as to why this node might be removed or just even
> where in the OpenLayers library such a call might happen?
> 
> Thanks
> 
> - Ray
> 
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
> 
> 
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/root-parentNode-is-null-for-svg-renderer-tp5560727p5565013.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


More information about the Dev mailing list