From 8ede1f648612b650a9cb488f05aefa386b0e8968 Mon Sep 17 00:00:00 2001 From: Patrick Filler Date: Tue, 16 Aug 2011 15:26:37 -0400 Subject: [PATCH] update to latest version of chosen --- chosen/chosen.proto.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js index f3ffdbb..39c206e 100644 --- a/chosen/chosen.proto.js +++ b/chosen/chosen.proto.js @@ -86,8 +86,8 @@ return this.set_tab_index(); }; Chosen.prototype.register_observers = function() { - this.container.observe("click", __bind(function(evt) { - return this.container_click(evt); + this.container.observe("mousedown", __bind(function(evt) { + return this.container_mousedown(evt); }, this)); this.container.observe("mouseenter", __bind(function(evt) { return this.mouse_enter(evt); @@ -95,8 +95,8 @@ this.container.observe("mouseleave", __bind(function(evt) { return this.mouse_leave(evt); }, this)); - this.search_results.observe("click", __bind(function(evt) { - return this.search_results_click(evt); + this.search_results.observe("mouseup", __bind(function(evt) { + return this.search_results_mouseup(evt); }, this)); this.search_results.observe("mouseover", __bind(function(evt) { return this.search_results_mouseover(evt); @@ -129,8 +129,8 @@ }, this)); } }; - Chosen.prototype.container_click = function(evt) { - if (evt && evt.type === "click") { + Chosen.prototype.container_mousedown = function(evt) { + if (evt && evt.type === "mousedown") { evt.stop(); } if (!this.pending_destroy_click) { @@ -156,7 +156,7 @@ }; Chosen.prototype.input_focus = function(evt) { if (!this.active_field) { - return setTimeout(this.container_click.bind(this), 50); + return setTimeout(this.container_mousedown.bind(this), 50); } }; Chosen.prototype.input_blur = function(evt) { @@ -340,7 +340,7 @@ return this.search_field.removeClassName("default"); } }; - Chosen.prototype.search_results_click = function(evt) { + Chosen.prototype.search_results_mouseup = function(evt) { var target; target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result"); if (target) { @@ -693,8 +693,16 @@ return Chosen; })(); root.Chosen = Chosen; + if (Prototype.Browser.IE) { + if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { + Prototype.BrowserFeatures['Version'] = new Number(RegExp.$1); + } + } document.observe('dom:loaded', function(evt) { var select, selects, _i, _len, _results; + if (Prototype.Browser.IE && (Prototype.BrowserFeatures['Version'] === 6 || Prototype.BrowserFeatures['Version'] === 7)) { + return; + } selects = $$(".chzn-select"); _results = []; for (_i = 0, _len = selects.length; _i < _len; _i++) {