'
link = $('#' + choice_id).find("a").first()
link.click (evt) => this.choice_destroy_link_click(evt)
@@ -402,7 +402,7 @@ class Chosen
results = 0
- searchText = if @search_field.val() is @default_text then "" else $.trim @search_field.val()
+ searchText = if @search_field.val() is @default_text then "" else $('').text($.trim(@search_field.val())).html()
regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
@@ -414,12 +414,12 @@ class Chosen
found = false
result_id = option.dom_id
- if regex.test option.text
+ if regex.test option.html
found = true
results += 1
- else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0
+ else if option.html.indexOf(" ") >= 0 or option.html.indexOf("[") == 0
#TODO: replace this substitution of /\[\]/ with a list of characters to skip.
- parts = option.text.replace(/\[|\]/g, "").split(" ")
+ parts = option.html.replace(/\[|\]/g, "").split(" ")
if parts.length
for part in parts
if regex.test part
@@ -428,11 +428,11 @@ class Chosen
if found
if searchText.length
- startpos = option.text.search zregex
- text = option.text.substr(0, startpos + searchText.length) + '' + option.text.substr(startpos + searchText.length)
+ startpos = option.html.search zregex
+ text = option.html.substr(0, startpos + searchText.length) + '' + option.html.substr(startpos + searchText.length)
text = text.substr(0, startpos) + '' + text.substr(startpos)
else
- text = option.text
+ text = option.html
$("#" + result_id).html text if $("#" + result_id).html != text
@@ -467,7 +467,7 @@ class Chosen
no_results: (terms) ->
no_results_html = $('
No results match ""
')
- no_results_html.find("span").first().text(terms)
+ no_results_html.find("span").first().html(terms)
@search_results.append no_results_html
@@ -632,6 +632,7 @@ class SelectParser
options_index: @options_index
value: option.value
text: option.text
+ html: option.innerHTML
selected: option.selected
disabled: if group_disabled is true then group_disabled else option.disabled
group_array_index: group_position
diff --git a/example.jquery.html b/example.jquery.html
index 8117d61..9b7dfed 100644
--- a/example.jquery.html
+++ b/example.jquery.html
@@ -809,6 +809,7 @@
Into This