Is there any possibility to change the __proto__
property of an object in IE9 or IE10?
Or is MS still not planning to include it in their JS engine?
I need it in a very special situation where I need to change __proto__
after the object is created.
__proto__
is going to be standardized in ES6. It is currently in Appendix B of the ES6 draft which in practice means that if it is implemented it needs to have the following semantics.__proto__
is both available as an accessor onObject.prototype
which means that all objects can read and write it by default. However, it can be removed fromObject.prototype
(usingdelete
). Once deleted__proto__
will work as a normal data property with no side effects on setting.__proto__
is also a special syntactic form in object literals. It will work to set the [[Prototype]] even ifObject.prototype.__proto__
was deleted.ES6 also introduces
Object.setPrototypeOf
(not in the appendix). This is preferred over setting__proto__
.__proto__
is available in all modern browsers, including Internet Explorer 11.A nonanswer as a last case resort:
Change your code so that all the properties that would originally be accessed via the changed prototype are now accessed via explicit delegation over a normal property:
to
__proto__
is included in IE11 found in the leaked build of Windows Blue: http://fremycompany.com/BG/2013/Internet-Explorer-11-rsquo-s-leaked-build-395/I'm not sure what exactly it is you're after since your question didn't specify, but for most uses of proto, you should be able to use
prototype
.