fix(button): guard against _nativeButton not defined

This commit is contained in:
Joren Broekema 2019-10-09 16:23:47 +02:00
parent dfb42593d2
commit 1a22c9bc5f

View file

@ -175,7 +175,7 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement))
* Dispatch submit event and invoke submit on the native form when clicked * Dispatch submit event and invoke submit on the native form when clicked
*/ */
__clickDelegationHandler() { __clickDelegationHandler() {
if (this.type === 'submit' && this._nativeButtonNode.form) { if (this.type === 'submit' && this._nativeButtonNode && this._nativeButtonNode.form) {
this._nativeButtonNode.form.dispatchEvent(new Event('submit')); this._nativeButtonNode.form.dispatchEvent(new Event('submit'));
this._nativeButtonNode.form.submit(); this._nativeButtonNode.form.submit();
} }