wesleytodd/setprototypeof

IE9/10 and inheritance

eKoopmans opened this issue · 1 comments

Hi @wesleytodd, thanks for the package! It looks simple and very well-used.

By my testing, this does not behave correctly on IE9/10 - is that correct? What I mean is the problem described here, where changes to the parent prototype aren't reflected in the child:

var foo = { a: 1 };
var bar = { b: 2 };
setPrototypeOf(bar, foo);
bar.a; // 1
foo.a = 2;
bar.a; // 1 - should be 2

IE9/10 do not have setPrototypeOf or __proto__, which means that they will default to the mixinProperties definition. Looks like that just copies the properties with no link. My testing confirms that bar.a returns 1 instead of 2 at the end, using setPrototypeOf() in IE9/10.

Is this deliberate? I believe I could fix the behaviour, let me know and I'll submit a PR.

Edit: Changed the example to use the setPrototypeOf() syntax.

To keep things consolidated, I am doing to move your comments here into your PR.