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.

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];
    },


> The main reason being that cross-browser support for hasOwnProperty is
> fairly recent (Safari 2 doesn't have it for example).

I didn't know that, thanks for the info. What happens if you use 
hasOwnProperty in Safari 2?

I don't have any usage statistics but I'd guess Safari 2 isn't used much now. 
According to Wikipedia the last version was 2.0.4, released 13th January 2006 
and was replaced with 3.0.0 on the 11th June 2007.


> [1] http://erik.eae.net/archives/2005/06/06/22.13.54/

> On Mar 5, 6:34 pm, Jim Higson <[email protected]> wrote:
> > On Thursday 05 March 2009 16:16:05 Jim Higson wrote:
> > > Hi,
> > >
> > > Is anybody else finding this? Does Prototype from git work with FF3.1?
> >
> > On closer inspection, it is quite easy to get Prototype to throw similar
> > errors even in FF3. It just happens that my present code only provokes it
> > in 3.1.
> >
> > For example here:http://users.ox.ac.uk/~admn2094/test.html
> >
> > Basically, writeAttribute tries to add an attribute called 'foo'
> > somewhere with the value
> > "function foo(){ return "@@" }" and this fails because of the illegal @
> > char.
> >
> > Are you not allowed to extend Object when using prototype? Prototype
> > doesn't seem to do any hasOwnProperty checks:
> >
> > http://yuiblog.com/blog/2006/09/26/for-in-intrigue/
> >
> > File as a bug?
> >
> > --
> > Jim
> > my wiki ajaxification thing:http://wikizzle.org
> > my blog:http://jimhigson.blogspot.com/
>
> 
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to