The widget method works according to all jQuery UI Widgets, please see: http://api.jqueryui.com/jQuery.widget/#method-widget
There is a usage example in the default demo, please see: https://github.com/fnagel/jquery-ui/blob/selectmenu/demos/selectmenu/default.html#L33
Use .filter() if you need to apply classes to only one, the button or the menu.