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

Reply via email to