Bugfix in card-maker

This commit is contained in:
Thomas Lovén 2019-11-12 22:16:42 +01:00
parent b732307245
commit cd230cc89b
2 changed files with 4 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,8 @@ const redefineElement = function(element, newClass) {
// Non-static properties of class
const properties = Object.getOwnPropertyDescriptors(newClass.prototype);
for(const [k,v] of Object.entries(properties)) {
Object.defineProperty(element, k, v);
if(k === "constructor") continue;
Object.defineProperty(element.prototype, k, v);
}
// Static properties of class
const staticProperties = Object.getOwnPropertyDescriptors(newClass);
@ -57,6 +58,7 @@ const redefineElement = function(element, newClass) {
// Non-static properties of superclass
const baseProperties = Object.getOwnPropertyDescriptors(superclass.prototype);
for(const [k,v] of Object.entries(baseProperties)) {
if(k === "constructor") continue;
Object.defineProperty(Object.getPrototypeOf(element).prototype, k, v);
}
// Static properties of superclassk