" ),
menu = self.options.nativeMenu ? this._native(this.element) : this._custom(),
selectID = select.attr( "id" ),
label = $( "label[for='"+ selectID +"']" ).addClass( "ui-select" ),
// IE throws an exception at options.item() function when
// there is no selected item
// select first in this case
selectedIndex = select[ 0 ].selectedIndex == -1 ? 0 : select[ 0 ].selectedIndex,
// TODO values buttonId and menuId are undefined here
button = menu.button
.text( $( select[ 0 ].options.item( selectedIndex ) ).text() )
.insertBefore( select )
.buttonMarkup({
theme: o.theme,
icon: o.icon,
iconpos: o.iconpos,
inline: o.inline,
corners: o.corners,
shadow: o.shadow,
iconshadow: o.iconshadow
}),
// Multi select or not
isMultiple = self.isMultiple = select[ 0 ].multiple;
// Opera does not properly support opacity on select elements
// In Mini, it hides the element, but not its text
// On the desktop,it seems to do the opposite
// for these reasons, using the nativeMenu option results in a full native select in Opera
if ( o.nativeMenu && window.opera && window.opera.version ) {
select.addClass( "ui-select-nativeonly" );
}
//vars for non-native menus
if ( !o.nativeMenu ) {
var options = select.find("option"),
buttonId = selectID + "-button",
menuId = selectID + "-menu",
thisPage = select.closest( ".ui-page" ),
//button theme
theme = /ui-btn-up-([a-z])/.exec( button.attr( "class" ) )[1],
menuPage = $( "
" +
"
" +
"
" + label.text() + "
"+
"
"+
"
"+
"
" )
.appendTo( $.mobile.pageContainer )
.page(),
menuPageContent = menuPage.find( ".ui-content" ),
menuPageClose = menuPage.find( ".ui-header a" ),
screen = $( "
", {"class": "ui-selectmenu-screen ui-screen-hidden"})
.appendTo( thisPage ),
listbox = $("
", { "class": "ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all ui-body-" + o.overlayTheme + " " + $.mobile.defaultDialogTransition })
.insertAfter(screen),
list = $( "