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
This commit is contained in:
euzuro
2006-07-04 23:55:34 +00:00
parent 63e0b37c67
commit 23c2ea1c04
2 changed files with 14 additions and 2 deletions

View File

@@ -74,6 +74,9 @@ OpenLayers.Layer.prototype = {
this.map.removeLayer(this);
}
this.map = null;
this.name = null;
this.div = null;
this.options = null;
},
/**

View File

@@ -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" );
}
// -->
</script>