From: Chris Date: Tue, 26 Nov 2013 07:55:22 +0000 (+0800) Subject: Roo.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=09cba64699bbbdb449bfd81af13a982a24dd61ba Roo.js --- 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; }, /**