From 509471eeca48d835f1211a44ad7a2106b4794571 Mon Sep 17 00:00:00 2001 From: Christian Weber Date: Fri, 23 Feb 2007 15:33:41 +0000 Subject: replaced dubious it_clone() by cleaner it_set() (aka copyObj() from lib.js) --- itjs/it.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'itjs') diff --git a/itjs/it.js b/itjs/it.js index 1a792f3..89e68a7 100644 --- a/itjs/it.js +++ b/itjs/it.js @@ -6,7 +6,6 @@ function CED(txt) { var element = document.getElementById('jsdebug'); - if (element) element.innerHTML = txt ? txt : ""; } @@ -17,7 +16,6 @@ function CED(txt) function ED() { var element = document.getElementById('jsdebug'); - if (element) { var text = ""; @@ -141,25 +139,21 @@ function it_get_iframe_document(iframe) } /** - * Clone src value and return dst. If dst is given then src attributes are - * copied into it, otherwise a new object is created. Also works with scalar - * values. Performs a deep copy of objects - * @param src Source object/value to clone - * @param dst Destination object to copy attributes from src to (optional) - * @return dst holding copy of src + * Copy attributes from src to dst in a recursive manner. + * @param dst Destination object which gets attributes + * @param src Source object containing attributes */ -function it_clone(src, dst) +function it_set(dst, src) { - if (typeof src == "object") + if (dst) { - if (!dst) - dst = {}; - for (var i in src) - dst[i] = it_clone(src[i]); + { + if (typeof src[i] == 'object') + it_set(dst[i], src[i]); + else + dst[i] = src[i]; + } } - else - dst = src; - - return dst; } + -- cgit v1.2.3