On Friday 06 March 2009 15:26:49 kangax wrote: > On Mar 6, 5:49 am, Jim Higson <j...@wikizzle.org> wrote: > > On Thursday 05 March 2009 23:22:26 Tobie Langel wrote: > > > Hi, > > > > > > Extending Object.prototype is regarded as a Bad Thing[1]. > > > > Does Prototype state anywhere that it doesn't work if Object.prototype is > > extended? If this is a stated limitation then fair enough I guess. > > I think not, but probably should. Mind creating a ticket?
Done: http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/587- failure-with-augmented-objectprototype-not-documented > > It seems like some parts of Prototype are designed to work with code that > > adds to Object.Prototype, for example in the Hash class we have: > > > > get: function(key) { > > // simulating poorly supported hasOwnProperty > > if (this._object[key] !== Object.prototype[key]) > > return this._object[key]; > > }, > > Not exactly. The fact that it "works" with augmented > `Object.prototype` is only a consequence of another workaround :) The > check is there to return only user-defined "keys"; Even without > `Object.prototype` modification, you would get unexpected result when > querying for, say, `toString` on a new Hash instance: > > $H({ foo: 1, bar: 2 }).get('toString'); > > It's possible that we'll introduce a custom `hasOwnProperty` in later > revisions. Makes sense. if( !hasOwnProperty ) hasOwnProperty = function hasOwnProperty(){ ... }; [...snip...] -- Jim my wiki ajaxification thing: http://wikizzle.org my blog: http://jimhigson.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---