Clear highlight on backspace.

This commit is contained in:
Patrick Filler 2011-07-13 12:11:44 -04:00
parent b46227fc5f
commit d16cf5f3da
4 changed files with 7 additions and 2 deletions

View file

@ -600,6 +600,7 @@
if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
return this.keydown_backstroke(); return this.keydown_backstroke();
} else if (!this.pending_backstroke) { } else if (!this.pending_backstroke) {
this.result_clear_highlight();
return this.results_search(); return this.results_search();
} }
break; break;

View file

@ -608,6 +608,7 @@
if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) { if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
return this.keydown_backstroke(); return this.keydown_backstroke();
} else if (!this.pending_backstroke) { } else if (!this.pending_backstroke) {
this.result_clear_highlight();
return this.results_search(); return this.results_search();
} }
break; break;
@ -649,13 +650,14 @@
} }
}; };
Chosen.prototype.search_field_scale = function() { 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) { if (this.is_multiple) {
h = 0; h = 0;
w = 0; w = 0;
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; 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']; 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) + ";"; style_block += style + ":" + this.search_field.getStyle(style) + ";";
} }
div = new Element('div', { div = new Element('div', {

View file

@ -531,6 +531,7 @@ class Chosen
if @is_multiple and @backstroke_length < 1 and @choices > 0 if @is_multiple and @backstroke_length < 1 and @choices > 0
this.keydown_backstroke() this.keydown_backstroke()
else if not @pending_backstroke else if not @pending_backstroke
this.result_clear_highlight()
this.results_search() this.results_search()
when 13 when 13
evt.preventDefault() evt.preventDefault()

View file

@ -516,6 +516,7 @@ class Chosen
if @is_multiple and @backstroke_length < 1 and @choices > 0 if @is_multiple and @backstroke_length < 1 and @choices > 0
this.keydown_backstroke() this.keydown_backstroke()
else if not @pending_backstroke else if not @pending_backstroke
this.result_clear_highlight()
this.results_search() this.results_search()
when 13 when 13
evt.preventDefault() evt.preventDefault()