Just for my curiosity - why not simply do:
Object.getClass = /*...*/

why the extra function call if you aren't supplying the code dynamically?

On Mon, Dec 6, 2010 at 12:46 AM, Arian <[email protected]> wrote:

> What you are doing is implementing new methods in Object.prototype.
>
> You really shouldn't use Object.implement!
> There's plenty info on the internet that explains this, for example
> http://erik.eae.net/archives/2005/06/06/22.13.54/
>
> You can use Object.extend, for example like:
>
> https://github.com/mootools/mootools-core/blob/master/Source/Types/Object.js
> The methods/functions can then be used as Object.equals(firstObject,
> secondObject);
>
>
>
> On Dec 5, 7:27 pm, ZsZs <[email protected]> wrote:
> > Hi,
> >
> > I want to extend the Object with some methods, like getClass(),
> > equals(), compare(), etc. Here is an example implementation:
> >
> > Object.implement({
> >    getClass : function() {
> >       var constructorName = this.constructor.toString();
> >       return constructorName.match( /function (\w+)\(.+/ )[1];
> >    }
> >
> > });
> >
> > This code runs fine in FireFox, Chrome, but fails in IE. After a long
> > debugging I found that the issue is related to:
> >
> > // IE purge
> > if (window.attachEvent && !window.addEventListener)
> > window.addListener('unload', function(){
> >         Object.each(collected, clean);
> >         if (window.CollectGarbage) CollectGarbage();
> >
> > });
> >
> > The concrete error : "attached[events].keys is null" in
> > removeEvents(); in line: 4062 of mootools-core-1.3.js
> >
> > Please let me know how can I overcome on this problem.
> >
> > Thanks,
> > Zsolt
>



-- 
Arieh Glazer
אריה גלזר
052-5348-561
http://www.arieh.co.il
http://www.link-wd.co.il

Reply via email to