vendor/assets/javascripts/chosen.proto.coffee in chosen-rails-1.3.0 vs vendor/assets/javascripts/chosen.proto.coffee in chosen-rails-1.4.1
- old
+ new
@@ -49,12 +49,12 @@
on_ready: ->
@form_field.fire("chosen:ready", {chosen: this})
register_observers: ->
- @container.observe "touchstart", (evt) => this.container_mousedown(evt)
- @container.observe "touchend", (evt) => this.container_mouseup(evt)
+ @container.observe "touchstart", (evt) => this.container_mousedown(evt); evt.preventDefault()
+ @container.observe "touchend", (evt) => this.container_mouseup(evt); evt.preventDefault()
@container.observe "mousedown", (evt) => this.container_mousedown(evt)
@container.observe "mouseup", (evt) => this.container_mouseup(evt)
@container.observe "mouseenter", (evt) => this.mouse_enter(evt)
@container.observe "mouseleave", (evt) => this.mouse_leave(evt)
@@ -356,10 +356,12 @@
@search_field.value = ""
@form_field.simulate("change") if typeof Event.simulate is 'function' && (@is_multiple || @form_field.selectedIndex != @current_selectedIndex)
@current_selectedIndex = @form_field.selectedIndex
+ evt.preventDefault()
+
this.search_field_scale()
single_set_selected_text: (text=@default_text) ->
if text is @default_text
@selected_item.addClassName("chosen-default")
@@ -391,10 +393,10 @@
return unless @allow_single_deselect
@selected_item.down("span").insert { after: "<abbr class=\"search-choice-close\"></abbr>" } unless @selected_item.down("abbr")
@selected_item.addClassName("chosen-single-with-deselect")
get_search_text: ->
- if @search_field.value is @default_text then "" else @search_field.value.strip().escapeHTML()
+ @search_field.value.strip().escapeHTML()
winnow_results_set_highlight: ->
if not @is_multiple
do_high = @search_results.down(".result-selected.active-result")