chore(dialog): allow for not having an invokerNode

This commit is contained in:
Joren Broekema 2019-11-28 15:55:51 +01:00 committed by Thomas Allmer
parent 0b3149469a
commit d1a410346d

View file

@ -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() {