at least in Firefox is working like that:

var blackMagic = Object.getOwnPropertyDescriptor(
  Object.prototype, '__proto__'
).set;

var NaO = Object.create(null);

var o = {};

blackMagic.call(NaO, o);

o.isPrototypeOf(NaO); // true

if this will work cross browser like this adopting a method rather than a
property that who knows if it'se there or not seems to be a natural
consequence, same way almost every library I know use

var hasOP = {}.hasOwnProperty

then hasOP.call(obj, prop)
 so even Object.create(null) can be checked like that

Best Regards







On Sun, Apr 14, 2013 at 9:23 PM, Nathan Wall <nathan.w...@live.com> wrote:

> Brendan Eich wrote:
> > ...
> https://mail.mozilla.org/pipermail/es-discuss/2013-February/028631.html
> >
> > It looks like the setter throws only if called on an object from a
> > different "realm", so maybe it will work for your intended uses. It
> > won't work cross-frame, in other words.
> >
> > /be
>
> Great!  Will the setter be capable of setting the prototype on objects
> which don't inherit from `Object.prototype` (as long as they're in the same
> realm)?  If so, that would allow me to work around the majority of my
> problems from [1].  There are still some edge cases that couldn't be
> supported, but I'll be okay with that since they are really minor edge
> cases.
>
> [1] https://mail.mozilla.org/pipermail/es-discuss/2013-March/029329.html
>
> Nathan
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to