From d1a410346decd1d654d31818bab1724aad134df9 Mon Sep 17 00:00:00 2001 From: Joren Broekema Date: Thu, 28 Nov 2019 15:55:51 +0100 Subject: [PATCH] chore(dialog): allow for not having an invokerNode --- packages/dialog/src/LionDialog.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/dialog/src/LionDialog.js b/packages/dialog/src/LionDialog.js index abecc9cac..fbe015e24 100644 --- a/packages/dialog/src/LionDialog.js +++ b/packages/dialog/src/LionDialog.js @@ -21,11 +21,16 @@ export class LionDialog extends OverlayMixin(LitElement) { this.__toggle = () => { this.opened = !this.opened; }; - this._overlayCtrl.invokerNode.addEventListener('click', this.__toggle); + + if (this._overlayCtrl.invokerNode) { + this._overlayCtrl.invokerNode.addEventListener('click', this.__toggle); + } } _teardownOpenCloseListeners() { - this._overlayCtrl.invokerNode.removeEventListener('click', this.__toggle); + if (this._overlayCtrl.invokerNode) { + this._overlayCtrl.invokerNode.removeEventListener('click', this.__toggle); + } } render() {