Constructor to create a new multiselect using the given select.

@param {jQuery} select
@param {Object} options
@returns {Multiselect}
485537
function Multiselect(select, options) {

        this.$select = $(select);

        // Placeholder via data attributes
        if (this.$select.attr("data-placeholder")) {
            options.nonSelectedText = this.$select.data("placeholder");
        }

        this.options = this.mergeOptions($.extend({}, options, this.$select.data()));

        // Initialization.
        // We have to clone to create a new reference.
        this.originalOptions = this.$select.clone()[0].options;
        this.query = '';
        this.searchTimeout = null;
        this.lastToggledInput = null

        this.options.multiple = this.$select.attr('multiple') === "multiple";
        this.options.onChange = $.proxy(this.options.onChange, this);
        this.options.onDropdownShow = $.proxy(this.options.onDropdownShow, this);
        this.options.onDropdownHide = $.proxy(this.options.onDropdownHide, this);
        this.options.onDropdownShown = $.proxy(this.options.onDropdownShown, this);
        this.options.onDropdownHidden = $.proxy(this.options.onDropdownHidden, this);

        // Build select all if enabled.
        this.buildContainer();
        this.buildButton();
        this.buildDropdown();
        this.buildSelectAll();
        this.buildDropdownOptions();
        this.buildFilter();

        this.updateButtonText();
        this.updateSelectAll();

        if (this.options.disableIfEmpty && $('option', this.$select).length <= 0) {
            this.disable();
        }

        this.$select.hide().after(this.$container);
    }
1166630
function() {
    // Save on blur for multi-select
    if(this.multiple) {
        Ev.addListener(this.dropdown, "blur", function(v){
            // Save on change
            this.save();
        }, this, true);
    }
    // Save on change for single-select
    else {
        Ev.addListener(this.dropdown, "change", function(v){
            // Save on change
            this.save();
        }, this, true);
    }
}
798059
function (options) {
		
		var selectFieldConfig, operators, labels, selectOptions, newOptions, i, length;
		
		selectFieldConfig = this.generateSelectConfig(options.availableFields);
		
		operators = options.operators || ["=", ">", "<", ">=", "<=", "!=", "LIKE", "NOT LIKE", "IS NULL", "IS NOT NULL"];
		labels = options.operatorLabels || operators;
		
		selectOptions = [];
		
		for (i = 0, length = operators.length; i < length; i += 1) {
			selectOptions.push({ value: operators[i], label: labels[i] });
		}
		
		newOptions = {
			fields: [
				selectFieldConfig,
				{type: 'select', choices: selectOptions},
				this.nameIndex[options.availableFields[0].name]
			]
		};
		
		YAHOO.lang.augmentObject(newOptions, options);
		
		inputEx.KeyValueField.superclass.setOptions.call(this, newOptions);
	}
829699
protected function createSelectElement($options, $selected, $_attributes, &$return)
    {
        $return = '<select'.$this->attributes($_attributes).'>';

        if( is_array($options) ) foreach( $options as $key => $value )
        {
            if( is_array($selected) )
            {
                if( in_array($key, $selected) )
                {
                    $select = ' selected="selected"';
                }
                else
                {
                    $select = "";
                }
            }
            else
            {
                if( $selected == $key )
                {
                    $select = ' selected="selected"';
                }
                else
                {
                    $select = "";
                }
            }

            $return .= '<option value="'.$key.'"'.$select.'>'.$value.'</option>'.EOL;
        }

        $return .= '</select>'.EOL;
    }
497772
function(select, option, type) {
        // Add disabled attr if disabled
        var disabledClass = (option.is(':disabled')) ? 'disabled ' : '';
        var optgroupClass = (type === 'optgroup-option') ? 'optgroup-option ' : '';
        var multipleCheckbox = multiple ? '<input type="checkbox"' + disabledClass + '/><label></label>' : '';

        // add icons
        var icon_url = option.data('icon');
        var classes = option.attr('class');
        if (!!icon_url) {
          var classString = '';
          if (!!classes) classString = ' class="' + classes + '"';

          // Check for multiple type.
          options.append($('<li class="' + disabledClass + optgroupClass + '"><img alt="" src="' + icon_url + '"' + classString + '><span>' + multipleCheckbox + option.html() + '</span></li>'));
          return true;
        }

        // Check for multiple type.
        options.append($('<li class="' + disabledClass + optgroupClass + '"><span>' + multipleCheckbox + option.html() + '</span></li>'));
      }
396542
function select(choice)
        {
            newSelection = false;
            if ($scope.multiple)
            {
                if (arrayObjectIndexOf($scope.data.selected, choice) === -1)
                {
                    $scope.data.selected.push(choice);
                }
            }
            else
            {
                $scope.data.selected = [choice];
            }
        }
1090376
def multi_select(self, elements_to_select):
        
        # Click the first element
        first_element = elements_to_select.pop()
        self.click(first_element)

        # Click the rest
        for index, element in enumerate(elements_to_select, start=1):
            self.multi_click(element)
223404
function initSelect(newVal, oldVal) {
                            if (attrs.multiple) {
                                if (oldVal !== undefined && newVal !== undefined) {
                                    if (oldVal.length === newVal.length) {
                                        return;
                                    }
                                }
                                var activeUl = element.siblings("ul.active");
                                if (newVal !== undefined && activeUl.length) { // If select is open
                                    var selectedOptions = activeUl.children("li.active").length; // Number of selected elements
                                    if (selectedOptions == newVal.length) {
                                        return;
                                    }
                                }
                            }

                            element.siblings(".caret").remove();
                            function fixActive () {
                                if (!attrs.multiple) {
                                    var value = element.val();
                                    var ul = element.siblings("ul");
                                    ul.find("li").each(function () {
                                        var that = $(this);
                                        if (that.text() === value) {
                                            that.addClass("active");
                                        }
                                    });
                                }
                            }
                            scope.$evalAsync(function () {
                                //element.material_select();
                                //Lines 301-311 fix Dogfalo/materialize/issues/901 and should be removed and the above uncommented whenever 901 is fixed
                                element.material_select(function () {
                                    if (!attrs.multiple) {
                                        element.siblings('input.select-dropdown').trigger('close');
                                    }
                                    fixActive();
                                });
                                var onMouseDown = function (e) {
                                    // preventing the default still allows the scroll, but blocks the blur.
                                    // We're inside the scrollbar if the clientX is >= the clientWidth.
                                    if (e.clientX >= e.target.clientWidth || e.clientY >= e.target.clientHeight) {
                                        e.preventDefault();
                                    }
                                };
                                element.siblings('input.select-dropdown').off("mousedown.material_select_fix").on('mousedown.material_select_fix', onMouseDown);

                                fixActive();

                                element.siblings('input.select-dropdown').off("click.material_select_fix").on("click.material_select_fix", function () {
                                    $("input.select-dropdown").not(element.siblings("input.select-dropdown")).trigger("close");
                                });
                            });
                        }
586212
function(option) {

  // Swap alias and name around.
  if (option.name && option.alias && option.name.length > option.alias.length) {
    var name = option.alias;
    option.alias = option.name;
    option.name = name;
  }

  var defaults = {
    alias: null,
    kind: 'boolean'
  };
  var keys = Object.keys(option);
  _.each(defaults, function(val, key) {
    if (!_.contains(keys, key)) {
      option[key] = val;
    }
  });
}
1142450
public ElementActionBuilder select(String ... options) {
        DropDownSelectAction action = new DropDownSelectAction();
        action.setOptions(Arrays.asList(options));
        action(action);
        return new ElementActionBuilder(action);
    }
755329
function multiSelect(arr, left, right, n, compare) {
    var stack = [left, right],
        mid;

    while (stack.length) {
        right = stack.pop();
        left = stack.pop();

        if (right - left <= n) continue;

        mid = left + Math.ceil((right - left) / n / 2) * n;
        quickselect(arr, mid, left, right, compare);

        stack.push(left, mid, mid, right);
    }
}
242517
function(select) {
    var
      placeholder = select.placeholder || false,
      values      = select.values || {},
      html        = ''
    ;
    html +=  '<i class="dropdown icon"></i>';
    if(select.placeholder) {
      html += '<div class="default text">' + placeholder + '</div>';
    }
    else {
      html += '<div class="text"></div>';
    }
    html += '<div class="menu">';
    $.each(select.values, function(index, option) {
      html += (option.disabled)
        ? '<div class="disabled item" data-value="' + option.value + '">' + option.name + '</div>'
        : '<div class="item" data-value="' + option.value + '">' + option.name + '</div>'
      ;
    });
    html += '</div>';
    return html;
  }
988785
def create_selection():
    
    operation = Forward()
    nested = Group(Suppress("(") + operation + Suppress(")")).setResultsName("nested")
    select_expr = Forward()
    functions = select_functions(select_expr)
    maybe_nested = functions | nested | Group(var_val)
    operation <<= maybe_nested + OneOrMore(oneOf("+ - * /") + maybe_nested)
    select_expr <<= operation | maybe_nested
    alias = Group(Suppress(upkey("as")) + var).setResultsName("alias")
    full_select = Group(
        Group(select_expr).setResultsName("selection") + Optional(alias)
    )
    return Group(
        Keyword("*") | upkey("count(*)") | delimitedList(full_select)
    ).setResultsName("attrs")
721133
function SelectList(options) {
		this.options = $.extend({
			holder: null,
			maxVisibleItems: 10,
			selectOnClick: true,
			useHoverClass: false,
			useCustomScroll: false,
			handleResize: true,
			multipleSelectWithoutKey: false,
			alwaysPreventMouseWheel: false,
			indexAttribute: 'data-index',
			cloneClassPrefix: 'jcf-option-',
			containerStructure: '<span class="jcf-list"><span class="jcf-list-content"></span></span>',
			containerSelector: '.jcf-list-content',
			captionClass: 'jcf-optgroup-caption',
			disabledClass: 'jcf-disabled',
			optionClass: 'jcf-option',
			groupClass: 'jcf-optgroup',
			hoverClass: 'jcf-hover',
			selectedClass: 'jcf-selected',
			scrollClass: 'jcf-scroll-active'
		}, options);
		this.init();
	}
148413
function initSelect( elem, parsed, extra){
  var self = this;
  var wc = this.$watch(parsed, function(newValue){
    var children = elem.getElementsByTagName('option');
    for(var i =0, len = children.length ; i < len; i++){
      if(children[i].value == newValue){
        elem.selectedIndex = i;
        break;
      }
    }
  }, STABLE);

  function handler(){
    parsed.set(self, this.value);
    wc.last = this.value;
    self.$update();
  }
  // var isChanging = true 
  // var __change = function(){
  //   if(isChanging) return;
  //   isChanging = true;
  //   setTimeout(handler,0)
  // }

  dom.on( elem, "change", handler );

  
  if(parsed.get(self) === undefined && elem.value){
    parsed.set(self, elem.value);
  }

  return function destroy(){
    dom.off(elem, "change", handler);
    // @TODO remove __change function 
    // elem.__change = null;
  }
}
748344
function(select, klass) {
		var spirit;
		if (this.initialized) {
			if (typeof klass === "string") {
				spirit = gui.Object.lookup(klass);
			} else {
				spirit = klass;
			}
			if (!gui.debug || gui.Type.isSpiritConstructor(spirit)) {
				this._channels.unshift([select, spirit]);
			} else {
				console.error('Bad spirit for selector "' + select + '": ' + spirit);
			}
		} else { // wait for method ready to invoke.
			this._todochannels = this._todochannels || [];
			this._todochannels.push([select, klass]);
		}
	}
668804
public function addMultipleSelect(string $name) : Element\Select\MultipleSelect
    {
        $select = new Element\Select\MultipleSelect($this, $name . '[]');
        $this->addComponent($name, $select);

        return $select;
    }