Allow select.group and select.order accepting string and list
551598
def _by_columns(self, columns):
        
        return columns if self.isstr(columns) else self._backtick_columns(columns)
997250
function(item) {
        var itemIsId = Selectivity.isValidId(item);
        var id = itemIsId ? item : this.validateItem(item) && item.id;

        if (this.options.allowDuplicates || this._value.indexOf(id) === -1) {
            this._value.push(id);

            if (itemIsId && this.options.initSelection) {
                this.options.initSelection(
                    [id],
                    function(data) {
                        if (this._value.indexOf(id) > -1) {
                            item = this.validateItem(data[0]);
                            this._data.push(item);

                            this.triggerChange({ added: item });
                        }
                    }.bind(this)
                );
            } else {
                if (itemIsId) {
                    item = this.getItemForId(id);
                }
                this._data.push(item);

                this.triggerChange({ added: item });
            }
        }

        this.input.value = '';
        this._updateInputWidth();
    }
534602
function re_basicSortRows(field, sortType) {
    var oThis = this,
        groupField = this.gridComp.options.groupField;
    var dataType = "";

    if (!field) {
        this.rows = new Array();
        this.groupRows = new Array();
        if (this.options.values) {
            $.each(this.options.values, function (i) {
                var rowObj = {};
                rowObj.value = this;
                rowObj.valueIndex = i;
                oThis.rows.push(rowObj);
                oThis.addOneRowGroup(rowObj);
                oThis.rows = oThis.getGroupRows();
            });
        }
        return;
    }
    if (groupField && field && groupField != field) {
        oThis.rows = [];
        $.each(this.groupRows, function () {
            var nowGroup = this;
            nowGroup.rows.sort(oThis.gridComp.SortByFun(field, sortType));
            oThis.rows = oThis.rows.concat(nowGroup.rows);
        });
    } else {
        this.rows.sort(this.gridComp.SortByFun(field, sortType));
    }
}
1039501
function() {

            this.$select.children().each($.proxy(function(index, element) {

                // Support optgroups and options without a group simultaneously.
                var tag = $(element).prop('tagName')
                    .toLowerCase();

                if ($(element).prop('value') == this.options.selectAllValue) {
                    return;
                }

                if (tag === 'optgroup') {
                    this.createOptgroup(element);
                }
                else if (tag === 'option') {

                    if ($(element).data('role') === 'divider') {
                        this.createDivider();
                    }
                    else {
                        this.createOptionValue(element);
                    }

                }

                // Other illegal tags will be ignored.
            }, this));

            // Bind the change event on the dropdown elements.
            $('li input', this.$ul).on('change', $.proxy(function(event) {
                var $target = $(event.target);

                var checked = $target.prop('checked') || false;
                var isSelectAllOption = $target.val() === this.options.selectAllValue;

                // Apply or unapply the configured selected class.
                if (this.options.selectedClass) {
                    if (checked) {
                        $target.parents('li')
                            .addClass(this.options.selectedClass);
                    }
                    else {
                        $target.parents('li')
                            .removeClass(this.options.selectedClass);
                    }
                }

                // Get the corresponding option.
                var value = $target.val();
                var $option = this.getOptionByValue(value);

                var $optionsNotThis = $('option', this.$select).not($option);
                var $checkboxesNotThis = $('input', this.$container).not($target);

                if (isSelectAllOption) {
                    if (checked) {
                        this.selectall();
                    }
                    else {
                        this.deselectall();
                    }
                }

                if(!isSelectAllOption){
                    if (checked) {
                        $option.prop('selected', true);

                        if (this.options.multiple) {
                            // Simply select additional option.
                            $option.prop('selected', true);
                        }
                        else {
                            // Unselect all other options and corresponding checkboxes.
                            if (this.options.selectedClass) {
                                $($checkboxesNotThis).parents('li').removeClass(this.options.selectedClass);
                            }

                            $($checkboxesNotThis).prop('checked', false);
                            $optionsNotThis.prop('selected', false);

                            // It's a single selection, so close.
                            this.$button.click();
                        }

                        if (this.options.selectedClass === "active") {
                            $optionsNotThis.parents("a").css("outline", "");
                        }
                    }
                    else {
                        // Unselect option.
                        $option.prop('selected', false);
                    }
                }

                this.$select.change();

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

                this.options.onChange($option, checked);

                if(this.options.preventInputChangeEvent) {
                    return false;
                }
            }, this));

            $('li a', this.$ul).on('touchstart click', function(event) {
                event.stopPropagation();

                var $target = $(event.target);

                if (event.shiftKey) {
                    var checked = $target.prop('checked') || false;

                    if (checked) {
                        var prev = $target.parents('li:last')
                            .siblings('li[class="active"]:first');

                        var currentIdx = $target.parents('li')
                            .index();
                        var prevIdx = prev.index();

                        if (currentIdx > prevIdx) {
                            $target.parents("li:last").prevUntil(prev).each(
                                function() {
                                    $(this).find("input:first").prop("checked", true)
                                        .trigger("change");
                                }
                            );
                        }
                        else {
                            $target.parents("li:last").nextUntil(prev).each(
                                function() {
                                    $(this).find("input:first").prop("checked", true)
                                        .trigger("change");
                                }
                            );
                        }
                    }
                }

                $target.blur();
            });

            // Keyboard support.
            this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) {
                if ($('input[type="text"]', this.$container).is(':focus')) {
                    return;
                }
                if ((event.keyCode === 9 || event.keyCode === 27)
                        && this.$container.hasClass('open')) {

                    // Close on tab or escape.
                    this.$button.click();
                }
                else {
                    var $items = $(this.$container).find("li:not(.divider):not(.disabled) a").filter(":visible");

                    if (!$items.length) {
                        return;
                    }

                    var index = $items.index($items.filter(':focus'));

                    // Navigation up.
                    if (event.keyCode === 38 && index > 0) {
                        index--;
                    }
                    // Navigate down.
                    else if (event.keyCode === 40 && index < $items.length - 1) {
                        index++;
                    }
                    else if (!~index) {
                        index = 0;
                    }

                    var $current = $items.eq(index);
                    $current.focus();

                    if (event.keyCode === 32 || event.keyCode === 13) {
                        var $checkbox = $current.find('input');

                        $checkbox.prop("checked", !$checkbox.prop("checked"));
                        $checkbox.change();
                    }

                    event.stopPropagation();
                    event.preventDefault();
                }
            }, this));
        }
71391
def selecteq(table, field, value, complement=False):
    """"""

    return selectop(table, field, value, operator.eq, complement=complement)
1310735
def selectlt(table, field, value, complement=False):
    """"""

    value = Comparable(value)
    return selectop(table, field, value, operator.lt, complement=complement)
809416
function validSemverTag(list, tag) {
    if (semver.valid(tag)) {
        list.push(tag);
    }

    return list;
}
1209898
function(event) {
		var datalistSelect = event.target,
			datalist = datalistSelect.parentNode,
			input = dcmnt.querySelector('input[list="' + datalist.id + '"]');

		// Check for whether the events target was a select or whether the input doesn't exist
		if (datalistSelect.tagName.toLowerCase() !== 'select' || input === null) {
			return;
		}

		// Determine a relevant key - either printable characters (that would have a length of 1) or controlling like Backspace
		if (event.key && (event.key === 'Backspace' || event.key.length === 1)) {
			input.focus();

			if (event.key === 'Backspace') {
				input.value = input.value.substr(0, input.value.length - 1);

				// Dispatch the input event on the related input[list]
				dispatchInputEvent(input);
			} else {
				input.value += event.key;
			}

			prepOptions(datalist, input);
		}
	}
697343
function acceptable($list=NULL) {
		$accept=[];
		foreach (explode(',',str_replace(' ','',@$_SERVER['HTTP_ACCEPT']))
			as $mime)
			if (preg_match('/(.+?)(?:;q=([\d\.]+)|$)/',$mime,$parts))
				$accept[$parts[1]]=isset($parts[2])?$parts[2]:1;
		if (!$accept)
			$accept['*/*']=1;
		else {
			krsort($accept);
			arsort($accept);
		}
		if ($list) {
			if (is_string($list))
				$list=explode(',',$list);
			foreach ($accept as $mime=>$q)
				if ($q && $out=preg_grep('/'.
					str_replace('\*','.*',preg_quote($mime,'/')).'/',$list))
					return current($out);
			return FALSE;
		}
		return $accept;
	}
1216437
private void validateGroupByItem(SqlSelect select, SqlNode groupByItem) {
		final SqlValidatorScope groupByScope = getGroupScope(select);
		groupByScope.validateExpr(groupByItem);
	}
1235687
def optgroups(self, name, value, attrs=None):
        """"""
        default = (None, [], 0)
        groups = [default]
        has_selected = False
        selected_choices = {str(v) for v in value}
        if not self.is_required and not self.allow_multiple_selected:
            default[1].append(self.create_option(name, '', '', False, 0))
        if not isinstance(self.choices, ModelChoiceIterator):
            return super(ModelSelect2Mixin, self).optgroups(name, value, attrs=attrs)
        selected_choices = {
            c for c in selected_choices
            if c not in self.choices.field.empty_values
        }
        field_name = self.choices.field.to_field_name or 'pk'
        query = Q(**{'%s__in' % field_name: selected_choices})
        for obj in self.choices.queryset.filter(query):
            option_value = self.choices.choice(obj)[0]
            option_label = self.label_from_instance(obj)

            selected = (
                str(option_value) in value and
                (has_selected is False or self.allow_multiple_selected)
            )
            if selected is True and has_selected is False:
                has_selected = True
            index = len(default[1])
            subgroup = default[1]
            subgroup.append(self.create_option(name, option_value, option_label, selected_choices, index))
        return groups
1183612
function groupHighlights(highlights) {
    let order = [],
        chunks = {},
        grouped = [];

    highlights.forEach(function (hl) {
        let timestamp = hl.getAttribute(TIMESTAMP_ATTR);

        if (typeof chunks[timestamp] === 'undefined') {
            chunks[timestamp] = [];
            order.push(timestamp);
        }

        chunks[timestamp].push(hl);
    });

    order.forEach(function (timestamp) {
        let group = chunks[timestamp];

        grouped.push({
            chunks: group,
            timestamp: timestamp,
            toString: function () {
                return group.map(function (h) {
                    return h.textContent;
                }).join('');
            }
        });
    });

    return grouped;
}
3215
def clause(grouped_columns_calculations = nil)
      return nil if sorts_by_method? || default_sorting?

      # unless the sorting is by method, create the sql string
      order = []
      each do |sort_column, sort_direction|
        next if constraint_columns.include? sort_column.name
        sql = grouped_columns_calculations&.dig(sort_column.name) || sort_column.sort[:sql]
        next if sql.blank?
        sql = sql.to_sql if sql.respond_to?(:to_sql)

        parts = Array(sql).map do |column|
          mongoid? ? [column, sort_direction] : "#{column} #{sort_direction}"
        end
        order << parts
      end

      order << @primary_key_order_clause if @sorting_by_primary_key
      order.flatten!(1)
      order unless order.empty?
    end
509219
def complete_opt_allow_select_scan(self, text, *_):
        
        return [t for t in ("true", "false", "yes", "no") if t.startswith(text.lower())]
944239
def select(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    where = dict(where, **kwargs).items()
    sql, args = makeSQL("SELECT", table, cols, where, group, order, limit)
    return execute(sql, args)
1175204
function parseList(list, whitelist, context) {
    const parsed = list.split(',');
    parsed.forEach(item => checkWhitelist(item, whitelist, context));
    return parsed;
}
720850
def add_order_by_for_association_limiting!(sql, options)
      return sql if options[:order].blank?

      order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)
      order.map! {|s| $1 if s =~ / (.*)/}
      order = order.zip((0...order.size).to_a).map { |s,i| "alias_#{i}__ #{s}" }.join(', ')

      sql << "ORDER BY #{order}"
    end