JS error at `fakeProto[pnames[i]] = constructor.prototype[pnames[i]];`
I just got a js error on the demo page :
This line cause the js error:
fakeProto[pnames[i]] = constructor.prototype[pnames[i]];
should be changed to:
Object.defineProperty(fakeProto, pnames[i], Object.getOwnPropertyDescriptor(constructor.prototype, pnames[i]));
Sorry, the gh-pages branch was outdated. It ought to be fixed, now.
If the constructor.prototype[pnames[i]] property is defined as a getter/setter, the getter function will be invoked when you use constructor.prototype[pnames[i]] expression on the right hand side of assignment operation, and you will lose the getter/setter definitions, so the right way is using getOwnPropertyDescriptor and defineProperty to copy properties.