Browse Source

do not leak click events. fixes #1622

Igor Vaynberg 12 years ago
parent
commit
fb8bf6d51d
1 changed files with 7 additions and 2 deletions
  1. 7 2
      select2.js

+ 7 - 2
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));