diff --git a/core-selector.html b/core-selector.html index 0035319..9e5b7f1 100644 --- a/core-selector.html +++ b/core-selector.html @@ -245,6 +245,9 @@ }, get items() { + if (!this.target) { + return []; + } var nodes = this.target !== this ? (this.itemsSelector ? this.target.querySelectorAll(this.itemsSelector) : this.target.children) : this.$.items.getDistributedNodes(); @@ -257,10 +260,12 @@ if (old) { this.removeListener(old); this.observer.disconnect(); + this.clearSelection(); } if (this.target) { this.addListener(this.target); this.observer.observe(this.target, {childList: true}); + this.updateSelected(); } },