Merge pull request #313 from ing-bank/fix/buttonGuard

[button] Guard against _nativeButton not defined
This commit is contained in:
Thijs Louisse 2019-10-10 11:18:26 +02:00 committed by GitHub
commit 19000fff56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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();
} }