src/bselect.js
function() {
            var bselect = _callMethod( this, "element" );
            var optionList = bselect.find( ".bselect-option-list" ).empty();
            var mapping = {};
            var i = 0;

            bselect.toggleClass( "disabled", this.prop( "disabled" ) );

            this.find( "option, > optgroup" ).each(function() {
                var classes, li;
                var isOption = $( this ).is( "option" );

                if ( isOption && !this.value ) {
                    return;
                }

                if ( isOption ) {
                    classes = "bselect-option";
                    if ( $( this ).closest( "optgroup" ).length ) {
                        classes += " grouped";
                    }
                } else {
                    classes = "bselect-option-group";
                }

                li = $( "<li />" ).attr({
                    "class": classes,
                    // While there aren't roles for optgroup, we'll stick with the role option.
                    role: "option",
                    tabindex: isOption ? 2 : -1,
                    "aria-selected": "false"
                });

                if ( isOption ) {
                    li.data( "value", this.value );
                    mapping[ this.value ] = i;

                    li.html( "<a href='#'>" + this.text + "</a>" );
                } else {
                    li.text( this.label );
                }

                li.appendTo( optionList );
                i++;
            });

            if ( i === 0 ) {
                showNoOptionsAvailable( this );
            }

            this.data( dataName ).itemsMap = mapping;
            return this;
        }
function() {
            var bselect = _callMethod( this, "element" );
            var optionList = bselect.find( ".bselect-option-list" ).empty();
            var mapping = {};
            var i = 0;

            bselect.toggleClass( "disabled", this.prop( "disabled" ) );

            this.find( "option, > optgroup" ).each(function() {
                var classes, li;
                var isOption = $( this ).is( "option" );

                if ( isOption && !this.value ) {
                    return;
                }

                if ( isOption ) {
                    classes = "bselect-option";
                    if ( $( this ).closest( "optgroup" ).length ) {
                        classes += " grouped";
                    }
                } else {
                    classes = "bselect-option-group";
                }

                li = $( "<li />" ).attr({
                    "class": classes,
                    // While there aren't roles for optgroup, we'll stick with the role option.
                    role: "option",
                    tabindex: isOption ? 2 : -1,
                    "aria-selected": "false"
                });

                if ( isOption ) {
                    li.data( "value", this.value );
                    mapping[ this.value ] = i;

                    li.html( "<a href='#'>" + this.text + "</a>" );
                } else {
                    li.text( this.label );
                }

                li.appendTo( optionList );
                i++;
            });

            if ( i === 0 ) {
                showNoOptionsAvailable( this );
            }

            this.data( dataName ).itemsMap = mapping;
            return this;
        }
function ( ) { var bselect = _callMethod ( this , "element" ) ; var optionList = bselect . find ( ".bselect-option-list" ) . empty ( ) ; var mapping = { } ; var i = 0 ; bselect . toggleClass ( "disabled" , this . prop ( "disabled" ) ) ; this . find ( "option, > optgroup" ) . each ( function ( ) { var classes , li ; var isOption = $ ( this ) . is ( "option" ) ; if ( isOption && ! this . value ) { return ; } if ( isOption ) { classes = "bselect-option" ; if ( $ ( this ) . closest ( "optgroup" ) . length ) { classes += " grouped" ; } } else { classes = "bselect-option-group" ; } li = $ ( "<li />" ) . attr ( { "class" : classes , // While there aren't roles for optgroup, we'll stick with the role option.
 role : "option" , tabindex : isOption ? 2 : - 1 , "aria-selected" : "false" } ) ; if ( isOption ) { li . data ( "value" , this . value ) ; mapping [ this . value ] = i ; li . html ( "<a href='#'>" + this . text + "</a>" ) ; } else { li . text ( this . label ) ; } li . appendTo ( optionList ) ; i ++ ; } ) ; if ( i === 0 ) { showNoOptionsAvailable ( this ) ; } this . data ( dataName ) . itemsMap = mapping ; return this ; }
Refreshes the option list. Useful when new HTML is added
Refreshes the option list . Useful when new HTML is added