From 09cba64699bbbdb449bfd81af13a982a24dd61ba Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 26 Nov 2013 15:55:22 +0800 Subject: [PATCH] Roo.js --- Roo.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Roo.js b/Roo.js index 34ffaec627..1c8a900b08 100644 --- a/Roo.js +++ b/Roo.js @@ -122,12 +122,21 @@ Roo.apply = function(o, c, defaults){ 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; }, /** -- 2.39.2