Skip to content

Commit 1d51378

Browse files
committed
pass entire option to format function
instead of just passing the text, give formatter a reference to the entire <option> element. Still passing opt.text() as the first argument to preserve back-compat
1 parent 8b8480c commit 1d51378

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ $.widget("ui.selectmenu", {
280280
var opt = $(this);
281281
selectOptionData.push({
282282
value: opt.attr('value'),
283-
text: self._formatText(opt.text()),
283+
text: self._formatText(opt),
284284
selected: opt.attr('selected'),
285285
disabled: opt.attr('disabled'),
286286
classes: opt.attr('class'),
@@ -623,9 +623,9 @@ $.widget("ui.selectmenu", {
623623
}
624624
},
625625

626-
_formatText: function(text) {
626+
_formatText: function(opt) {
627627
if (this.options.format) {
628-
text = this.options.format(text);
628+
text = this.options.format(opt.text(), opt);
629629
} else if (this.options.escapeHtml) {
630630
text = $('<div />').text(text).html();
631631
}

0 commit comments

Comments
 (0)