Error when clearing a single-select box multiple times. fix #908
This commit is contained in:
parent
26c33078bf
commit
8e9e65f864
14
select2.js
14
select2.js
@ -1749,13 +1749,15 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
// single
|
// single
|
||||||
clear: function() {
|
clear: function() {
|
||||||
var data=this.selection.data("select2-data");
|
var data=this.selection.data("select2-data");
|
||||||
this.opts.element.val("");
|
if (data) { // guard against queued quick consecutive clicks
|
||||||
this.selection.find("span").empty();
|
this.opts.element.val("");
|
||||||
this.selection.removeData("select2-data");
|
this.selection.find("span").empty();
|
||||||
this.setPlaceholder();
|
this.selection.removeData("select2-data");
|
||||||
|
this.setPlaceholder();
|
||||||
|
|
||||||
this.opts.element.trigger({ type: "removed", val: this.id(data), choice: data });
|
this.opts.element.trigger({ type: "removed", val: this.id(data), choice: data });
|
||||||
this.triggerChange({removed:data});
|
this.triggerChange({removed:data});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user