roojs-core.js
[roojs1] / roojs-core-debug.js
index 8f3cec0..63cfd49 100644 (file)
@@ -120,7 +120,25 @@ Roo.apply = function(o, c, defaults){
         BLANK_IMAGE_URL : "http:/"+"/localhost/s.gif",
 
         emptyFn : function(){},
+        
+        /**
+         *  Clone the object
+         *
+         *
+         */
+        clone : function(obj){
+            if (obj === null || typeof obj !== 'object') {
+                return obj;
+            }
+
+            var temp = obj.constructor(); // give temp the original obj's constructor
+            for (var key in obj) {
+                temp[key] = cloneObject(obj[key]);
+            }
 
+            return temp;
+        },
+        
         /**
          * Copies all the properties of config to obj if they don't already exist.
          * @param {Object} obj The receiver of the properties