This might be something that bugs on IE, im not sure dou.
The code works normally because:

$type(object[key])

is undefined (when you delete the key), so it doesnt enter any of the cases
from the switch.
Again, im not sure what happens here, maybe this is a bug that IE has, but i
dont know about it.
Maybe someone can help here?

--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interfaces


On Sat, Feb 6, 2010 at 6:37 PM, Romansky <[email protected]> wrote:

> 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??
>

Reply via email to