Does dojo have deep mixin like jQuery.extend? -
i know jquery has deep mixin such as
var options = $.extend(true,target,object1,object2) ,does dojo have?if have how use?if not how can same functionality?thanks!
they have "lang.mixin" (http://livedocs.dojotoolkit.org/dojo/_base/lang#mixin), it's not equivalent.
the following thread has more info: http://dojo-toolkit.33424.n3.nabble.com/deep-dojo-mixin-td3986157.html
and ken benjamin took time write this:
mixindeep: function(dest, source) { //recursively mix properties of 2 objects var empty = {}; (var name in source) { if(!(name in dest) || (dest[name] !== source[name] && (!(name in empty) || empty[name] !== source[name]))){ try { if ( source[name].constructor==object ) { dest[name] = this.mixindeep(dest[name], source[name]); } else { dest[name] = source[name]; }; } catch(e) { // property in destination object not set. create , set value. dest[name] = source[name]; }; }; } return dest; } however, has limitations arrays.
Comments
Post a Comment