From d16cf5f3daaebe1f019b29a801a259780bd2015a Mon Sep 17 00:00:00 2001 From: Patrick Filler Date: Wed, 13 Jul 2011 12:11:44 -0400 Subject: [PATCH] Clear highlight on backspace. --- chosen/chosen.jquery.js | 1 + chosen/chosen.proto.js | 6 ++++-- coffee/chosen.jquery.coffee | 1 + coffee/chosen.proto.coffee | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/chosen/chosen.jquery.js b/chosen/chosen.jquery.js index b889d63..b2f4016 100644 --- a/chosen/chosen.jquery.js +++ b/chosen/chosen.jquery.js @@ -600,6 +600,7 @@ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { return this.keydown_backstroke(); } else if (!this.pending_backstroke) { + this.result_clear_highlight(); return this.results_search(); } break; diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js index 27452b7..6ba1706 100644 --- a/chosen/chosen.proto.js +++ b/chosen/chosen.proto.js @@ -608,6 +608,7 @@ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { return this.keydown_backstroke(); } else if (!this.pending_backstroke) { + this.result_clear_highlight(); return this.results_search(); } break; @@ -649,13 +650,14 @@ } }; Chosen.prototype.search_field_scale = function() { - var dd_top, div, h, style, style_block, styles, w; + var dd_top, div, h, style, style_block, styles, w, _i, _len; if (this.is_multiple) { h = 0; w = 0; style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing']; - for (style in styles) { + for (_i = 0, _len = styles.length; _i < _len; _i++) { + style = styles[_i]; style_block += style + ":" + this.search_field.getStyle(style) + ";"; } div = new Element('div', { diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index e974c2d..4d1e79e 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -531,6 +531,7 @@ class Chosen if @is_multiple and @backstroke_length < 1 and @choices > 0 this.keydown_backstroke() else if not @pending_backstroke + this.result_clear_highlight() this.results_search() when 13 evt.preventDefault() diff --git a/coffee/chosen.proto.coffee b/coffee/chosen.proto.coffee index 3a8a5ac..c26643b 100644 --- a/coffee/chosen.proto.coffee +++ b/coffee/chosen.proto.coffee @@ -516,6 +516,7 @@ class Chosen if @is_multiple and @backstroke_length < 1 and @choices > 0 this.keydown_backstroke() else if not @pending_backstroke + this.result_clear_highlight() this.results_search() when 13 evt.preventDefault()