From 23c2ea1c0464383a92ec0f886860bf4420b9b726 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 4 Jul 2006 23:55:34 +0000 Subject: [PATCH] set all properties of layer to null on destroy. add test. git-svn-id: http://svn.openlayers.org/trunk/openlayers@883 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer.js | 3 +++ tests/test_Layer.html | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index d33fd6cd80..da59c77b0d 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -74,6 +74,9 @@ OpenLayers.Layer.prototype = { this.map.removeLayer(this); } this.map = null; + this.name = null; + this.div = null; + this.options = null; }, /** diff --git a/tests/test_Layer.html b/tests/test_Layer.html index a963f7d8f6..267c4426d7 100644 --- a/tests/test_Layer.html +++ b/tests/test_Layer.html @@ -82,12 +82,21 @@ */ function test_99_Layer_destroy (t) { - t.plan( 1 ); - layer = new OpenLayers.Layer('Test Layer'); + t.plan( 4 ); + var map = new OpenLayers.Map('map'); + + layer = new OpenLayers.Layer('Test Layer'); + map.addLayer(layer); + layer.destroy(); + + t.eq( layer.name, null, "layer.name is null after destroy" ); + t.eq( layer.div, null, "layer.div is null after destroy" ); t.eq( layer.map, null, "layer.map is null after destroy" ); + t.eq( layer.options, null, "layer.options is null after destroy" ); + } // -->