[OpenLayers-Commits] r3636 - in trunk/openlayers: lib/OpenLayers lib/OpenLayers/Layer tests

commits at openlayers.org commits at openlayers.org
Fri Jul 6 18:55:18 EDT 2007


Author: euzuro
Date: 2007-07-06 18:55:17 -0400 (Fri, 06 Jul 2007)
New Revision: 3636

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/WFS.js
   trunk/openlayers/lib/OpenLayers/Util.js
   trunk/openlayers/tests/test_Util.html
Log:
fix for #787 - put clearArray() in its place ((marked as deprecated, throwing a console warning during use, all usage replaced in code))

Modified: trunk/openlayers/lib/OpenLayers/Layer/WFS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WFS.js	2007-07-06 22:54:51 UTC (rev 3635)
+++ trunk/openlayers/lib/OpenLayers/Layer/WFS.js	2007-07-06 22:55:17 UTC (rev 3636)
@@ -385,10 +385,10 @@
         if (this.tile) {
             if (this.vectorMode) {
                 this.renderer.clear();
-                OpenLayers.Util.clearArray(this.features);
+                this.features.length = 0;
             } else {   
                 this.clearMarkers();
-                OpenLayers.Util.clearArray(this.markers);
+                this.markers.length = 0;
             }    
             this.tile.draw();
         }

Modified: trunk/openlayers/lib/OpenLayers/Util.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Util.js	2007-07-06 22:54:51 UTC (rev 3635)
+++ trunk/openlayers/lib/OpenLayers/Util.js	2007-07-06 22:55:17 UTC (rev 3636)
@@ -71,8 +71,16 @@
 
 /**
  * Function: clearArray
-*/
+ * *Deprecated*. This function will disappear in 3.0.
+ * Please use "array.length = 0" instead.
+ * 
+ * Parameters:
+ * array - {Array}
+ */
 OpenLayers.Util.clearArray = function(array) {
+    var msg = "OpenLayers.Util.clearArray() is Deprecated." +
+              " Please use 'array.length = 0' instead.";
+    OpenLayers.Console.warn(msg);
     array.length = 0;
 };
 

Modified: trunk/openlayers/tests/test_Util.html
===================================================================
--- trunk/openlayers/tests/test_Util.html	2007-07-06 22:54:51 UTC (rev 3635)
+++ trunk/openlayers/tests/test_Util.html	2007-07-06 22:55:17 UTC (rev 3636)
@@ -30,16 +30,12 @@
     }
 
     function test_03_Util_Array(t) {
-        t.plan( 2 );
+        t.plan( 1 );
 
         var array = new Array(1,2,3,4,5);
 
         OpenLayers.Util.removeItem(array, 3);
         t.eq( array.toString(), "1,2,4,5", "Util.removeItem works");    
-
-        OpenLayers.Util.clearArray(array);
-        t.eq( array.toString(), "", "Util.clearArray works");    
-        
     }
 
     function test_04_Util_createDiv(t) {



More information about the Commits mailing list