diff --git a/select2.js b/select2.js index 2869656c..eb0a21f6 100644 --- a/select2.js +++ b/select2.js @@ -688,15 +688,18 @@ the specific language governing permissions and limitations under the Apache Lic this.opts.element .data("select2", this) .attr("tabindex", "-1") - .before(this.container); + .before(this.container) + .on("click.select2", killEvent); // do not leak click events + this.container.data("select2", this); this.dropdown = this.container.find(".select2-drop"); syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass); - + this.dropdown.addClass(evaluate(opts.dropdownCssClass)); this.dropdown.data("select2", this); + this.dropdown.on("click", killEvent); this.results = results = this.container.find(resultsSelector); this.search = search = this.container.find("input.select2-input"); @@ -708,6 +711,8 @@ the specific language governing permissions and limitations under the Apache Lic // initialize the container this.initContainer(); + this.container.on("click", killEvent); + installFilteredMouseMove(this.results); this.dropdown.on("mousemove-filtered touchstart touchmove touchend", resultsSelector, this.bind(this.highlightUnderEvent));