1
0
mirror of synced 2024-11-23 05:26:10 +03:00

Error when clearing a single-select box multiple times. fix #908

This commit is contained in:
Igor Vaynberg 2013-02-20 18:35:55 -08:00
parent 26c33078bf
commit 8e9e65f864

View File

@ -1749,6 +1749,7 @@ 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");
if (data) { // guard against queued quick consecutive clicks
this.opts.element.val(""); this.opts.element.val("");
this.selection.find("span").empty(); this.selection.find("span").empty();
this.selection.removeData("select2-data"); this.selection.removeData("select2-data");
@ -1756,6 +1757,7 @@ the specific language governing permissions and limitations under the Apache Lic
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});
}
}, },
/** /**