each.html revision 1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749
<html>
<head>
<title>YUI 3.0</title>
<script type="text/javascript">
(function() {
// var Y = YUI().use('dump'), newobj = {};
var Y = YUI({core:['lang', 'array', 'core']}).use('*'), newobj = {};
var o = {
str: "str",
arr: [
"array1",
true,
{ obj: "obj"},
["array2"]
],
dat: new Date(),
fn: function() {
},
//win: window,
nada: null
};
Y.use('yui');
// return;
Y.each(o, function(v, k) {
Y.log("same? " + (this === newobj));
this[k] = v;
this.asdf = "asdf";
}, newobj);
Y.log("each: " + Y.Lang.dump(newobj));
var o1 = {
a: "a",
b: "b",
c: {
d: "d",
e: "e",
f: ["g", "h", "i"]
}
};
var o2 = {
a: "a2",
c: {
d: "d",
e: "e",
f: ["g2", "h2", "i2"],
j: "j2"
},
k: "k2"
};
// Y.mix(o1, o2, false, null, 0, true);
Y.aggregate(o1, o2);
Y.log("aggregate: " + Y.Lang.dump(o1));
})();
</script>
<body>
<input id="addButton" type="button" value="Add link" />
</body>
</html>