diff options
author | Christian Weber | 2007-02-23 15:33:41 +0000 |
---|---|---|
committer | Christian Weber | 2007-02-23 15:33:41 +0000 |
commit | 509471eeca48d835f1211a44ad7a2106b4794571 (patch) | |
tree | 705d6a95b436900ae1b23d76137de32ff4118756 /itjs | |
parent | 0a18a2df3f21f99c1e013723c434cfff76b2ab88 (diff) | |
download | itools-509471eeca48d835f1211a44ad7a2106b4794571.tar.gz itools-509471eeca48d835f1211a44ad7a2106b4794571.tar.bz2 itools-509471eeca48d835f1211a44ad7a2106b4794571.zip |
replaced dubious it_clone() by cleaner it_set() (aka copyObj() from lib.js)
Diffstat (limited to 'itjs')
-rw-r--r-- | itjs/it.js | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -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; } + |