diff --git a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts index be7d6ed12c..a56b6ab696 100644 --- a/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts +++ b/api/js/etemplate/Et2InputWidget/Et2InputWidget.ts @@ -55,6 +55,8 @@ const Et2InputWidgetMixin = >(superclass : T) // Validators for every instance of a type of widget protected defaultValidators : Validator[]; + protected isSlComponent = false; + /** WebComponent **/ static get styles() { @@ -142,6 +144,8 @@ const Et2InputWidgetMixin = >(superclass : T) this.defaultValidators = []; this.__readonly = false; + + this.isSlComponent = typeof (this).handleChange === 'function'; } connectedCallback() @@ -151,14 +155,14 @@ const Et2InputWidgetMixin = >(superclass : T) this.node = this.getInputNode(); this.updateComplete.then(() => { - this.addEventListener(typeof (this).handleChange === 'function' ? 'sl-change' : 'change', this._oldChange); + this.addEventListener(this.isSlComponent ? 'sl-change' : 'change', this._oldChange); }); } disconnectedCallback() { super.disconnectedCallback(); - this.removeEventListener(typeof (this).handleChange === 'function' ? 'sl-change' : 'change', this._oldChange); + this.removeEventListener(this.isSlComponent ? 'sl-change' : 'change', this._oldChange); } /**