dist/toolkit.js
function(option, index) {
        var select = this.element,
            dropdown = this.dropdown,
            options = this.options,
            selected = option.prop('selected'),
            activeClass = 'is-active';

        // Create elements
        var li = $('<li/>'),
            content = option.text(),
            description;

        if (selected) {
            li.addClass(activeClass);
        }

        if (description = this.readValue(option, options.getDescription)) {
            content += this.render(options.descTemplate).html(description).toString();
        }

        var a = $('<a/>', {
            html: content,
            href: 'javascript:;',
            role: 'option'
        }).aria('selected', selected);

        if (this.options.copyClasses) {
            this.copyClasses(option, li);
        }

        li.append(a);

        // Attach no events for disabled options
        if (option.prop('disabled')) {
            li.addClass('is-disabled');
            a.aria('disabled', true);

            return li;
        }

        // Set events
        if (this.multiple) {
            a.click(function() {
                var self = $(this),
                    selected = false;

                if (option.prop('selected')) {
                    self.parent().removeClass(activeClass);

                } else {
                    selected = true;
                    self.parent().addClass(activeClass);
                }

                option.prop('selected', selected);
                self.aria('selected', selected);

                select.change();
            });

        } else {
            var self = this;

            a.click(function() {
                dropdown
                    .find('li').removeClass(activeClass).end()
                    .find('a').aria('selected', false);

                $(this)
                    .aria('selected', true)
                    .parent()
                    .addClass(activeClass);

                self.hide();
                self.index = index;

                select.val(option.val());
                select.change();
            });
        }

        return li;
    }
function(option, index) {
        var select = this.element,
            dropdown = this.dropdown,
            options = this.options,
            selected = option.prop('selected'),
            activeClass = 'is-active';

        // Create elements
        var li = $('<li/>'),
            content = option.text(),
            description;

        if (selected) {
            li.addClass(activeClass);
        }

        if (description = this.readValue(option, options.getDescription)) {
            content += this.render(options.descTemplate).html(description).toString();
        }

        var a = $('<a/>', {
            html: content,
            href: 'javascript:;',
            role: 'option'
        }).aria('selected', selected);

        if (this.options.copyClasses) {
            this.copyClasses(option, li);
        }

        li.append(a);

        // Attach no events for disabled options
        if (option.prop('disabled')) {
            li.addClass('is-disabled');
            a.aria('disabled', true);

            return li;
        }

        // Set events
        if (this.multiple) {
            a.click(function() {
                var self = $(this),
                    selected = false;

                if (option.prop('selected')) {
                    self.parent().removeClass(activeClass);

                } else {
                    selected = true;
                    self.parent().addClass(activeClass);
                }

                option.prop('selected', selected);
                self.aria('selected', selected);

                select.change();
            });

        } else {
            var self = this;

            a.click(function() {
                dropdown
                    .find('li').removeClass(activeClass).end()
                    .find('a').aria('selected', false);

                $(this)
                    .aria('selected', true)
                    .parent()
                    .addClass(activeClass);

                self.hide();
                self.index = index;

                select.val(option.val());
                select.change();
            });
        }

        return li;
    }
function ( option , index ) { var select = this . element , dropdown = this . dropdown , options = this . options , selected = option . prop ( 'selected' ) , activeClass = 'is-active' ; // Create elements var li = $ ( '<li/>' ) , content = option . text ( ) , description ; if ( selected ) { li . addClass ( activeClass ) ; } if ( description = this . readValue ( option , options . getDescription ) ) { content += this . render ( options . descTemplate ) . html ( description ) . toString ( ) ; } var a = $ ( '<a/>' , { html : content , href : 'javascript:;' , role : 'option' } ) . aria ( 'selected' , selected ) ; if ( this . options . copyClasses ) { this . copyClasses ( option , li ) ; } li . append ( a ) ; // Attach no events for disabled options if ( option . prop ( 'disabled' ) ) { li . addClass ( 'is-disabled' ) ; a . aria ( 'disabled' , true ) ; return li ; } // Set events if ( this . multiple ) { a . click ( function ( ) { var self = $ ( this ) , selected = false ; if ( option . prop ( 'selected' ) ) { self . parent ( ) . removeClass ( activeClass ) ; } else { selected = true ; self . parent ( ) . addClass ( activeClass ) ; } option . prop ( 'selected' , selected ) ; self . aria ( 'selected' , selected ) ; select . change ( ) ; } ) ; } else { var self = this ; a . click ( function ( ) { dropdown . find ( 'li' ) . removeClass ( activeClass ) . end ( ) . find ( 'a' ) . aria ( 'selected' , false ) ; $ ( this ) . aria ( 'selected' , true ) . parent ( ) . addClass ( activeClass ) ; self . hide ( ) ; self . index = index ; select . val ( option . val ( ) ) ; select . change ( ) ; } ) ; } return li ; }
Build the list item to represent the select option.

@param {jQuery} option
@param {Number} index
@returns {jQuery}
Build the list item to represent the select option .