It does not ignore based on name -- if you define a property named 'toString' as a function (or some other object) it will be included in the for-in loop. But the for-in loop ignores 'build-in' properties like 'toString' on Object etc. and 'length' on Array.
-Tobias -----Oprindelig meddelelse----- Fra: prototype-core@googlegroups.com [mailto:[EMAIL PROTECTED] På vegne af jdalton Sendt: 30. maj 2007 16:06 Til: Prototype: Core Emne: [Prototype-core] To make Object.extend() support methods named 'toString' Hi guys, I was looking through some of my old source code and noticed that I added a modified Object.extend method. Apparently the normal for-in loop used in the Object.extend guts ignores methods named 'toString'. I fixed this: /* * * * * * * * * * * * * * * * * * * * * Prototype Extensions * * * * * * * * * * * * * * * * * * * */ Object.extend = function(destination, source) { //support null source var source = source || {}; if(source.toString){ //add support for copying toString() destination.toString = source.toString; } for (var property in source){ destination[property] = source[property]; } return destination; }; That's all. 8) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---