[OpenLayers-Commits] r11631 - in trunk/openlayers: lib/OpenLayers lib/OpenLayers/Control tests tests/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Mar 7 00:02:55 EST 2011


Author: bartvde
Date: 2011-03-06 21:02:51 -0800 (Sun, 06 Mar 2011)
New Revision: 11631

Modified:
   trunk/openlayers/lib/OpenLayers/Control.js
   trunk/openlayers/lib/OpenLayers/Control/PanZoom.js
   trunk/openlayers/tests/Control.html
   trunk/openlayers/tests/Control/PanZoomBar.html
Log:
Control should set this.div to null in destroy, thanks jorix for the updated patch, p=jorix,me r=me,fredj (closes #2850)

Modified: trunk/openlayers/lib/OpenLayers/Control/PanZoom.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/PanZoom.js	2011-03-07 01:26:56 UTC (rev 11630)
+++ trunk/openlayers/lib/OpenLayers/Control/PanZoom.js	2011-03-07 05:02:51 UTC (rev 11631)
@@ -64,10 +64,10 @@
      * APIMethod: destroy
      */
     destroy: function() {
-        OpenLayers.Control.prototype.destroy.apply(this, arguments);
         this.removeButtons();
         this.buttons = null;
         this.position = null;
+        OpenLayers.Control.prototype.destroy.apply(this, arguments);
     },
 
     /**

Modified: trunk/openlayers/lib/OpenLayers/Control.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control.js	2011-03-07 01:26:56 UTC (rev 11630)
+++ trunk/openlayers/lib/OpenLayers/Control.js	2011-03-07 05:02:51 UTC (rev 11631)
@@ -229,6 +229,7 @@
             this.map.removeControl(this);
             this.map = null;
         }
+        this.div = null;
     },
 
     /** 

Modified: trunk/openlayers/tests/Control/PanZoomBar.html
===================================================================
--- trunk/openlayers/tests/Control/PanZoomBar.html	2011-03-07 01:26:56 UTC (rev 11630)
+++ trunk/openlayers/tests/Control/PanZoomBar.html	2011-03-07 05:02:51 UTC (rev 11631)
@@ -44,8 +44,9 @@
         control = new OpenLayers.Control.PanZoomBar();
         map.addControl(control);
         control.removeButtons();
+        var div = control.div;
         map.destroy();
-        t.eq(control.div.childNodes.length, 0, "control's div cleared.");
+        t.eq(div.childNodes.length, 0, "control's div cleared.");
         t.eq(control.zoombarDiv, null, "zoombar div nullified.")
     }
 

Modified: trunk/openlayers/tests/Control.html
===================================================================
--- trunk/openlayers/tests/Control.html	2011-03-07 01:26:56 UTC (rev 11630)
+++ trunk/openlayers/tests/Control.html	2011-03-07 05:02:51 UTC (rev 11631)
@@ -60,7 +60,7 @@
     }
 
     function test_Control_destroy(t) {
-        t.plan(3);
+        t.plan(4);
     
         var map = new OpenLayers.Map('map');
         var control = new OpenLayers.Control();
@@ -70,6 +70,7 @@
         t.ok(map.controls[map.controls.length - 1] != control, "map.controls doesn't contains control");
 
         t.ok(control.map == null, "Control.map is null");
+        t.ok(control.div == null, "Control.div is null");
         t.ok(control.handler == null, "Control.handler is null");
     }
     



More information about the Commits mailing list