From ea3999d75568a5280d58e0a026574cb5138fa60d Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 14 Oct 2010 10:57:31 +0000 Subject: [PATCH] partially reverted r10732 (because we don't deactivate controls on destrly) and reverted r10810 (because it is not needed any more). r=elemoine (closes #2864) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10834 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control.js | 5 +---- lib/OpenLayers/Control/Panel.js | 1 - tests/Control/Panel.html | 11 +++-------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index 359e9b9502..916e9dab17 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -343,10 +343,7 @@ OpenLayers.Control = OpenLayers.Class({ this.displayClass.replace(/ /g, "") + "Active" ); } - // deal with the case where the control is destroyed - if(this.events) { - this.events.triggerEvent("deactivate"); - } + this.events.triggerEvent("deactivate"); return true; } return false; diff --git a/lib/OpenLayers/Control/Panel.js b/lib/OpenLayers/Control/Panel.js index 23e0c9a7d5..775fe6625d 100644 --- a/lib/OpenLayers/Control/Panel.js +++ b/lib/OpenLayers/Control/Panel.js @@ -95,7 +95,6 @@ OpenLayers.Control.Panel = OpenLayers.Class(OpenLayers.Control, { * APIMethod: destroy */ destroy: function() { - this.deactivate(); OpenLayers.Control.prototype.destroy.apply(this, arguments); for(var i = this.controls.length - 1 ; i >= 0; i--) { if(this.controls[i].events) { diff --git a/tests/Control/Panel.html b/tests/Control/Panel.html index 044f8de477..31c4ab6a19 100644 --- a/tests/Control/Panel.html +++ b/tests/Control/Panel.html @@ -227,8 +227,8 @@ t.ok(!controlNoDeactive.active, "Tool control autoActivate:true is not active"); } - function test_Control_Panel_dectivate (t) { - t.plan(3); + function test_Control_Panel_deactivate (t) { + t.plan(2); var map = new OpenLayers.Map('map'); var control = new OpenLayers.Control(); var panel = new OpenLayers.Control.Panel(); @@ -239,12 +239,7 @@ panel.deactivate(); t.ok(panel.div.innerHTML == "", "Panel is not displayed after deactivate without any active control"); - - panel.activate(); - var div = panel.div; - panel.destroy(); - t.eq(panel.div, null, - "Panel is not displayed after destroy without any active control"); + map.destroy(); }