Fix removing item twice
Add spec which is fixed with this commit.
In the `sTagsArea` zone there are two elements with the same `data-val`:
the `<span class="amsify-select-tag>` containing the selected tag and
the `<li class="amsify-list-item" data-val="1">` containing the
suggested tag.
This means every time we call `removeTag`, the `removeTagByItem`
function is called twice, and might remove extra items.
Suggested PR:
c8765a6915
This commit is contained in:
@@ -626,7 +626,7 @@ var AmsifySuggestags;
|
||||
|
||||
removeTag: function(value, animate=true) {
|
||||
var _self = this;
|
||||
$findTags = $(this.selectors.sTagsArea).find('[data-val="'+value+'"]');
|
||||
$findTags = $(this.selectors.inputArea).find('[data-val="'+value+'"]');
|
||||
if($findTags.length) {
|
||||
$findTags.each(function(){
|
||||
_self.removeTagByItem(this, animate);
|
||||
|
||||
Reference in New Issue
Block a user