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.removeLayer(this);
|
||||||
}
|
}
|
||||||
this.map = null;
|
this.map = null;
|
||||||
|
this.name = null;
|
||||||
|
this.div = null;
|
||||||
|
this.options = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+11
-2
@@ -82,12 +82,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function test_99_Layer_destroy (t) {
|
function test_99_Layer_destroy (t) {
|
||||||
t.plan( 1 );
|
t.plan( 4 );
|
||||||
layer = new OpenLayers.Layer('Test Layer');
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
|
layer = new OpenLayers.Layer('Test Layer');
|
||||||
|
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
layer.destroy();
|
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.map, null, "layer.map is null after destroy" );
|
||||||
|
t.eq( layer.options, null, "layer.options is null after destroy" );
|
||||||
|
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user