fnagel/jquery-ui — pull request #242 by sbeam (2012-07-05 15:08:14+00:00)
Title: enhance `format` option by passing entire option element to function

instead of just passing the text, give the formatter function a reference to the
entire option element during construction.

Still passing opt.text() as the first argument to preserve backwards compatibility, although this is now superfluous it does not seem worth it to break existing apps.

An example of why this is needed is in my use case which uses `data-` attributes from the original option elements to make the options look fancy:

$('#product_options select.calculatable').selectmenu({format : function(text, opt) {
return opt.text()
+ ''
+ format_price($(opt).data('adder'))
+ '';
}});