-
Notifications
You must be signed in to change notification settings - Fork 55
Avoid to create a new array each selection #153
base: master
Are you sure you want to change the base?
Avoid to create a new array each selection #153
Conversation
test/attr-for-selected.html
Outdated
@@ -204,7 +204,7 @@ | |||
assert.equal(selector.selectedItem, undefined); | |||
selector.multi = true; | |||
selector.selectedValues = ['non-existing-value']; | |||
assert.deepEqual(selector.selectedItems, [undefined]); | |||
assert.deepEqual(selector.selectedItems, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you select a non existing value the selectedItems must be an empty array
f90849f
to
d29ebb7
Compare
iron-multi-selectable.html
Outdated
if (this.multi) { | ||
this._setSelectedItems(s); | ||
if (isSelected) { | ||
this.splice('selectedItems', this.selectedItems.length, 0, item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply this.push('selectedItems', item);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, have sense. Changed.
iron-multi-selectable.html
Outdated
} else { | ||
this._setSelectedItems([s]); | ||
this._setSelectedItem(s); | ||
this._setSelectedItems(isSelected?[item]:[]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces: this._setSelectedItems(isSelected ? [item] : []);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
iron-multi-selectable.html
Outdated
this._setSelectedItems([s]); | ||
this._setSelectedItem(s); | ||
this._setSelectedItems(isSelected?[item]:[]); | ||
this._setSelectedItem(isSelected?item:undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces: this._setSelectedItem(isSelected ? item : undefined);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
iron-selectable.html
Outdated
_selectionChange: function() { | ||
this._setSelectedItem(this._selection.get()); | ||
_selectionChange: function(isSelected, item) { | ||
this._setSelectedItem(isSelected?item:undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces: this._setSelectedItem(isSelected ? item : undefined);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
d29ebb7
to
1750695
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 😄
7aee6b4
to
1750695
Compare
1750695
to
d4d03e9
Compare
Signed-off-by: Jorge del Casar <[email protected]>
d4d03e9
to
f10c99c
Compare
Friendly ping to @bicknellr (code owner). |
Solve #152
Signed-off-by: Jorge del Casar [email protected]