From 297ac0a141480bb35a14d7d5370edc7f9bdcf138 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 24 Aug 2011 02:37:38 +0000 Subject: [PATCH] adding upload symbol --- .../Ox.UI/themes/classic/svg/symbolUpload.svg | 4 ++++ source/Ox.js | 22 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 source/Ox.UI/themes/classic/svg/symbolUpload.svg diff --git a/source/Ox.UI/themes/classic/svg/symbolUpload.svg b/source/Ox.UI/themes/classic/svg/symbolUpload.svg new file mode 100644 index 00000000..6d1f0333 --- /dev/null +++ b/source/Ox.UI/themes/classic/svg/symbolUpload.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/source/Ox.js b/source/Ox.js index a2ff9e37..decda65a 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -289,21 +289,25 @@ Ox.avg = function(obj) { }; /*@ -Ox.clone Returns a (deep) copy of an object or array +Ox.clone Returns a (shallow or deep) copy of an object or array > (function() { a = ['val']; b = Ox.clone(a); a[0] = null; return b[0]; }()) 'val' > (function() { a = {key: 'val'}; b = Ox.clone(a); a.key = null; return b.key; }()) 'val' @*/ -Ox.clone = function(col) { - // return Ox.isArray(col) ? col.slice() : Ox.extend({}, col); - var clone = Ox.isArray(col) ? [] : {}; - Ox.forEach(col, function(val, key) { - clone[key] = ['array', 'object'].indexOf(Ox.typeOf(val)) > -1 - ? Ox.clone(val) : val; - }); - return clone; +Ox.clone = function(col, deep) { + var ret; + if (deep) { + ret = Ox.isArray(col) ? [] : {}; + Ox.forEach(col, function(val, key) { + ret[key] = ['array', 'object'].indexOf(Ox.typeOf(val)) > -1 + ? Ox.clone(val) : val; + }); + } else { + ret = Ox.isArray(col) ? col.slice() : Ox.extend({}, col); + } + return ret; }; /*@