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:
@@ -74,6 +74,9 @@ OpenLayers.Layer.prototype = {
|
||||
this.map.removeLayer(this);
|
||||
}
|
||||
this.map = null;
|
||||
this.name = null;
|
||||
this.div = null;
|
||||
this.options = null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user