Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

Commit

Permalink
fix inability to clear select by setting empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
mskocik committed May 27, 2021
1 parent b9f2467 commit 27ec00d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ class SvelecteElement extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (this.svelecte && oldValue !== newValue) {
name === 'value'
? this.svelecte.setSelection(formatValue(name, newValue))
? (newValue ? this.svelecte.setSelection(formatValue(name, newValue)) : this.svelecte.clearByParent(this.parent ? true : false))
: this.svelecte.$set({ [formatProp(name)]: formatValue(name, newValue) });
}
}
}

connectedCallback() {
setTimeout(() => { this.render() });
Expand Down

0 comments on commit 27ec00d

Please sign in to comment.