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,12 +21,17 @@ export class LionDialog extends OverlayMixin(LitElement) {
this.__toggle = () => { this.__toggle = () => {
this.opened = !this.opened; this.opened = !this.opened;
}; };
if (this._overlayCtrl.invokerNode) {
this._overlayCtrl.invokerNode.addEventListener('click', this.__toggle); this._overlayCtrl.invokerNode.addEventListener('click', this.__toggle);
} }
}
_teardownOpenCloseListeners() { _teardownOpenCloseListeners() {
if (this._overlayCtrl.invokerNode) {
this._overlayCtrl.invokerNode.removeEventListener('click', this.__toggle); this._overlayCtrl.invokerNode.removeEventListener('click', this.__toggle);
} }
}
render() { render() {
return html` return html`