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,6 +36,7 @@ class IgniteElement extends HTMLElement {
createProperties() { createProperties() {
var props = this.properties; var props = this.properties;
if (props != null) {
var keys = Object.keys(props); var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
let prop = new IgniteProperty(props[keys[i]]); let prop = new IgniteProperty(props[keys[i]]);
@ -58,6 +59,7 @@ class IgniteElement extends HTMLElement {
})(keys[i]); })(keys[i]);
} }
} }
}
/** /**
* Resets the properties for this element back to their original default * Resets the properties for this element back to their original default
@ -66,11 +68,13 @@ class IgniteElement extends HTMLElement {
resetProperties() { resetProperties() {
var props = this.properties; var props = this.properties;
if (props != null) {
var keys = Object.keys(props); var keys = Object.keys(props);
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
this[keys[i]] = props[keys[i]]; this[keys[i]] = props[keys[i]];
} }
} }
}
/** /**
* Setups this ignite element and constructs it's template when * Setups this ignite element and constructs it's template when