diff --git a/iron-multi-selectable.html b/iron-multi-selectable.html
index 96051d8..a2f79d7 100644
--- a/iron-multi-selectable.html
+++ b/iron-multi-selectable.html
@@ -127,19 +127,16 @@
}
},
- _selectionChange: function() {
- var s = this._selection.get();
+ _selectionChange: function(isSelected, item) {
if (this.multi) {
- this._setSelectedItems(s);
- this._setSelectedItem(s.length ? s[0] : null);
- } else {
- if (s !== null && s !== undefined) {
- this._setSelectedItems([s]);
- this._setSelectedItem(s);
+ if (isSelected) {
+ this.push('selectedItems', item);
} else {
- this._setSelectedItems([]);
- this._setSelectedItem(null);
+ this.splice('selectedItems', this.selectedItems.indexOf(item), 1);
}
+ } else {
+ this._setSelectedItems(isSelected ? [item] : []);
+ this._setSelectedItem(isSelected ? item : undefined);
}
},
diff --git a/iron-selectable.html b/iron-selectable.html
index 3f48273..765bc47 100644
--- a/iron-selectable.html
+++ b/iron-selectable.html
@@ -358,12 +358,12 @@
if (this.selectedAttribute) {
this.toggleAttribute(this.selectedAttribute, isSelected, item);
}
- this._selectionChange();
+ this._selectionChange(isSelected, item);
this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item});
},
- _selectionChange: function() {
- this._setSelectedItem(this._selection.get());
+ _selectionChange: function(isSelected, item) {
+ this._setSelectedItem(isSelected ? item : undefined);
},
// observe items change under the given node.