- onclick is fine being an attribute

- Avoid error when calling loadingFinished on a webComponent and the parent does not give/have a DOM node
This commit is contained in:
nathan 2021-08-20 10:37:41 -06:00
parent e6ecdd1b25
commit f00e4fb708

View File

@ -69,9 +69,9 @@ export const Et2Widget = <T extends Constructor<LitElement>>(superClass : T) =>
// Defined in parent hierarchy // Defined in parent hierarchy
//label: {type: String}, //label: {type: String},
onclick: { onclick: {
type: Function, type: Function
attribute: false
} }
}; };
} }
@ -86,7 +86,7 @@ export const Et2Widget = <T extends Constructor<LitElement>>(superClass : T) =>
constructor(...args : any[]) constructor(...args : any[])
{ {
super(...args); super(...args);
this.addEventListener("click", this._handleClick.bind(this)); this.addEventListener("click", this._handleClick.bind(this));
} }
@ -444,7 +444,7 @@ export const Et2Widget = <T extends Constructor<LitElement>>(superClass : T) =>
* rest themselves with their normal lifecycle (especially connectedCallback(), which is kind * rest themselves with their normal lifecycle (especially connectedCallback(), which is kind
* of the equivalent of doLoadingFinished() * of the equivalent of doLoadingFinished()
*/ */
if(this.getParent() instanceof et2_widget) if(this.getParent() instanceof et2_widget && this.getParent().getDOMNode(this))
{ {
this.getParent().getDOMNode(this).append(this); this.getParent().getDOMNode(this).append(this);
} }