Use innerhtml instead of text for definitive text

This commit is contained in:
Matthew Beale 2011-07-27 10:42:03 -04:00
parent cabd7eb618
commit 6f1d74de8a
3 changed files with 7 additions and 6 deletions

View file

@ -244,7 +244,7 @@
if (option.group_array_index != null) {
classes.push("group-option");
}
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text.escapeHTML() + '</li>';
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text + '</li>';
} else {
return "";
}
@ -726,7 +726,7 @@
};
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
if (option.nodeName === "OPTION") {
if (option.text !== "") {
if (option.innerHTML !== "") {
if (group_position != null) {
this.parsed[group_position].children += 1;
}
@ -734,7 +734,7 @@
array_index: this.parsed.length,
options_index: this.options_index,
value: option.value,
text: option.text,
text: option.innerHTML,
selected: option.selected,
disabled: group_disabled === true ? group_disabled : option.disabled,
group_array_index: group_position

View file

@ -213,7 +213,7 @@ class Chosen
classes.push "result-selected" if option.selected
classes.push "group-option" if option.group_array_index?
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text.escapeHTML() + '</li>'
'<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text + '</li>'
else
""
@ -603,14 +603,14 @@ class SelectParser
add_option: (option, group_position, group_disabled) ->
if option.nodeName is "OPTION"
if option.text != ""
if option.innerHTML != ""
if group_position?
@parsed[group_position].children += 1
@parsed.push
array_index: @parsed.length
options_index: @options_index
value: option.value
text: option.text
text: option.innerHTML
selected: option.selected
disabled: if group_disabled is true then group_disabled else option.disabled
group_array_index: group_position

View file

@ -809,6 +809,7 @@
<em>Into This</em>
<select title="Choose a Country..." class="chzn-select" multiple style="width:350px;" tabindex="4">
<option value=""></option>
<option value="hacked">Hackaroo &lt;script&gt;alert('hack');&lt;/script&gt;</option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>