Adding null check for the properties getter.

This commit is contained in:
Matt Mo 2020-08-23 17:06:18 -07:00
parent 7c0dfd9f7f
commit c7529f1efc

View File

@ -36,26 +36,28 @@ class IgniteElement extends HTMLElement {
createProperties() {
var props = this.properties;
var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) {
let prop = new IgniteProperty(props[keys[i]]);
this[`_${keys[i]}`] = prop;
if (props != null) {
var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) {
let prop = new IgniteProperty(props[keys[i]]);
this[`_${keys[i]}`] = prop;
((propName) => {
Object.defineProperty(this, propName, {
get: function () {
if (IgniteRenderingContext.rendering == false) {
return this[`_${propName}`].value;
} else {
return this[`_${propName}`];
((propName) => {
Object.defineProperty(this, propName, {
get: function () {
if (IgniteRenderingContext.rendering == false) {
return this[`_${propName}`].value;
} else {
return this[`_${propName}`];
}
},
set: function (value) {
this[`_${propName}`].value = value;
}
},
set: function (value) {
this[`_${propName}`].value = value;
}
});
})(keys[i]);
});
})(keys[i]);
}
}
}
@ -66,9 +68,11 @@ class IgniteElement extends HTMLElement {
resetProperties() {
var props = this.properties;
var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) {
this[keys[i]] = props[keys[i]];
if (props != null) {
var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) {
this[keys[i]] = props[keys[i]];
}
}
}