Skip to content

Commit 98d0dbc

Browse files
committed
added: feature for html escaping, see fnagel#131
1 parent d80f57b commit 98d0dbc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ $.widget("ui.selectmenu", {
3030
maxHeight: null,
3131
icons: null,
3232
format: null,
33+
escapeHtml: false,
3334
bgImage: function() {},
3435
wrapperElement: "<div />"
3536
},
@@ -624,9 +625,14 @@ $.widget("ui.selectmenu", {
624625
this.open(event);
625626
}
626627
},
627-
628+
628629
_formatText: function(text) {
629-
return (this.options.format ? this.options.format(text) : text);
630+
if (this.options.format) {
631+
text = this.options.format(text);
632+
} else if (this.options.escapeHtml) {
633+
text = $('<div />').text(text).html();
634+
}
635+
return text;
630636
},
631637

632638
_selectedIndex: function() {

0 commit comments

Comments
 (0)