diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index b3cbf65fcf..ad64e54b02 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -643,7 +643,15 @@ OpenLayers.Map = OpenLayers.Class({ /** * APIMethod: destroy - * Destroy this map + * Destroy this map. + * Note that if you are using an application which removes a container + * of the map from the DOM, you need to ensure that you destroy the + * map *before* this happens; otherwise, the page unload handler + * will fail because the DOM elements that map.destroy() wants + * to clean up will be gone. (See + * http://trac.osgeo.org/openlayers/ticket/2277 for more information). + * This will apply to GeoExt and also to other applications which + * modify the DOM of the container of the OpenLayers Map. */ destroy:function() { // if unloadDestroy is null, we've already been destroyed