The code was taken from mootools core 1.2.4
On Feb 6, 10:19 pm, Fábio M. Costa <[email protected]> wrote: > Whats the mootools version? > > -- > Fábio Miranda Costa > Solucione Sistemas > Engenheiro de interfaces > > On Sat, Feb 6, 2010 at 5:45 PM, Romansky <[email protected]> wrote: > > I am trying to understand what is Object.delete doing, here's the > > relevant code: > > ####################### > > Object.reset = function(object, key){ > > > if (key == null){ > > for (var p in object) Object.reset(object, p); > > return object; > > } > > > delete object[key]; > > > switch ($type(object[key])){ > > case 'object': > > var F = function(){}; > > F.prototype = object[key]; > > var i = new F; > > object[key] = Object.reset(i); > > break; > > case 'array': object[key] = $unlink(object[key]); break; > > } > > > return object; > > > }; > > ####################### > > > I dont understand how after : > > delete object[key]; > > you can do this: > > switch ($type(object[key])){ .... > > > Isnt the object[key] already unset by the delete?? > > How is it working??
