[OpenLayers-Commits] r11003 - in trunk/openlayers/lib/OpenLayers: . BaseTypes

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Jan 5 12:24:33 EST 2011


Author: tschaub
Date: 2011-01-05 09:24:32 -0800 (Wed, 05 Jan 2011)
New Revision: 11003

Modified:
   trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js
   trunk/openlayers/lib/OpenLayers/Util.js
Log:
Removing the OpenLayers.Util.extend method to the Class.js file to avoid a circular dependency that cannot be resolved with an arbitrary sort order. r=elemoine (closes #2992)

Modified: trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js	2011-01-05 17:21:58 UTC (rev 11002)
+++ trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js	2011-01-05 17:24:32 UTC (rev 11003)
@@ -106,3 +106,50 @@
        OpenLayers.Util.extend(C.prototype, o);
    }
 };
+
+/**
+ * APIFunction: extend
+ * Copy all properties of a source object to a destination object.  Modifies
+ *     the passed in destination object.  Any properties on the source object
+ *     that are set to undefined will not be (re)set on the destination object.
+ *
+ * Parameters:
+ * destination - {Object} The object that will be modified
+ * source - {Object} The object with properties to be set on the destination
+ *
+ * Returns:
+ * {Object} The destination object.
+ */
+OpenLayers.Util = OpenLayers.Util || {};
+OpenLayers.Util.extend = function(destination, source) {
+    destination = destination || {};
+    if (source) {
+        for (var property in source) {
+            var value = source[property];
+            if (value !== undefined) {
+                destination[property] = value;
+            }
+        }
+
+        /**
+         * IE doesn't include the toString property when iterating over an object's
+         * properties with the for(property in object) syntax.  Explicitly check if
+         * the source has its own toString property.
+         */
+
+        /*
+         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
+         * prototype object" when calling hawOwnProperty if the source object
+         * is an instance of window.Event.
+         */
+
+        var sourceIsEvt = typeof window.Event == "function"
+                          && source instanceof window.Event;
+
+        if (!sourceIsEvt
+           && source.hasOwnProperty && source.hasOwnProperty("toString")) {
+            destination.toString = source.toString;
+        }
+    }
+    return destination;
+};

Modified: trunk/openlayers/lib/OpenLayers/Util.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Util.js	2011-01-05 17:21:58 UTC (rev 11002)
+++ trunk/openlayers/lib/OpenLayers/Util.js	2011-01-05 17:24:32 UTC (rev 11003)
@@ -11,7 +11,7 @@
 /**
  * Namespace: Util
  */
-OpenLayers.Util = {};
+OpenLayers.Util = OpenLayers.Util || {};
 
 /** 
  * Function: getElement
@@ -54,53 +54,6 @@
     window.$ = OpenLayers.Util.getElement;
 }
 
-/**
- * APIFunction: extend
- * Copy all properties of a source object to a destination object.  Modifies
- *     the passed in destination object.  Any properties on the source object
- *     that are set to undefined will not be (re)set on the destination object.
- *
- * Parameters:
- * destination - {Object} The object that will be modified
- * source - {Object} The object with properties to be set on the destination
- *
- * Returns:
- * {Object} The destination object.
- */
-OpenLayers.Util.extend = function(destination, source) {
-    destination = destination || {};
-    if(source) {
-        for(var property in source) {
-            var value = source[property];
-            if(value !== undefined) {
-                destination[property] = value;
-            }
-        }
-
-        /**
-         * IE doesn't include the toString property when iterating over an object's
-         * properties with the for(property in object) syntax.  Explicitly check if
-         * the source has its own toString property.
-         */
-
-        /*
-         * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
-         * prototype object" when calling hawOwnProperty if the source object
-         * is an instance of window.Event.
-         */
-
-        var sourceIsEvt = typeof window.Event == "function"
-                          && source instanceof window.Event;
-
-        if(!sourceIsEvt
-           && source.hasOwnProperty && source.hasOwnProperty('toString')) {
-            destination.toString = source.toString;
-        }
-    }
-    return destination;
-};
-
-
 /** 
  * Function: removeItem
  * Remove an object from an array. Iterates through the array



More information about the Commits mailing list