Skip to content

Commit

Permalink
chore: commit built files
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Carlin committed Mar 25, 2020
1 parent e0d2795 commit 9789765
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 46 deletions.
31 changes: 9 additions & 22 deletions dist/js/select2.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,23 +755,6 @@ S2.define('select2/utils',[
});
};

// Append an array of jQuery nodes to a given element.
Utils.appendMany = function ($element, $nodes) {
// jQuery 1.7.x does not support $.fn.append() with an array
// Fall back to a jQuery object collection using $.fn.add()
if ($.fn.jquery.substr(0, 3) === '1.7') {
var $jqNodes = $();

$.map($nodes, function (node) {
$jqNodes = $jqNodes.add(node);
});

$nodes = $jqNodes;
}

$element.append($nodes);
};

// Cache objects in Utils.__cache instead of $.data (see #4346)
Utils.__cache = {};

Expand Down Expand Up @@ -943,9 +926,13 @@ S2.define('select2/results',[
.find('.select2-results__option[aria-selected]');

var $selected = $options.filter('[aria-selected=true]');
var $unselected = $options.filter('[aria-selected=false]');

// Check if there are any selected options
if ($selected.length > 0) {
// Check if there are any unselected options in tags mode
if ($unselected.length > 0 && this.options.get('tags')) {
$unselected.last().trigger('mouseenter');
} else if ($selected.length > 0) {
// Check if there are any selected options
// If there are selected options, highlight the first
$selected.first().trigger('mouseenter');
} else {
Expand Down Expand Up @@ -1799,7 +1786,7 @@ S2.define('select2/selection/multiple',[

var $rendered = this.$selection.find('.select2-selection__rendered');

Utils.appendMany($rendered, $selections);
$rendered.append($selections);
};

return MultipleSelection;
Expand Down Expand Up @@ -3337,7 +3324,7 @@ S2.define('select2/data/select',[
};

SelectAdapter.prototype.addOptions = function ($options) {
Utils.appendMany(this.$element, $options);
this.$element.append($options);
};

SelectAdapter.prototype.option = function (data) {
Expand Down Expand Up @@ -3542,7 +3529,7 @@ S2.define('select2/data/array',[
if (item.children) {
var $children = this.convertToOptions(item.children);

Utils.appendMany($option, $children);
$option.append($children);
}

$options.push($option);
Expand Down
2 changes: 1 addition & 1 deletion dist/js/select2.full.min.js

Large diffs are not rendered by default.

31 changes: 9 additions & 22 deletions dist/js/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,23 +755,6 @@ S2.define('select2/utils',[
});
};

// Append an array of jQuery nodes to a given element.
Utils.appendMany = function ($element, $nodes) {
// jQuery 1.7.x does not support $.fn.append() with an array
// Fall back to a jQuery object collection using $.fn.add()
if ($.fn.jquery.substr(0, 3) === '1.7') {
var $jqNodes = $();

$.map($nodes, function (node) {
$jqNodes = $jqNodes.add(node);
});

$nodes = $jqNodes;
}

$element.append($nodes);
};

// Cache objects in Utils.__cache instead of $.data (see #4346)
Utils.__cache = {};

Expand Down Expand Up @@ -943,9 +926,13 @@ S2.define('select2/results',[
.find('.select2-results__option[aria-selected]');

var $selected = $options.filter('[aria-selected=true]');
var $unselected = $options.filter('[aria-selected=false]');

// Check if there are any selected options
if ($selected.length > 0) {
// Check if there are any unselected options in tags mode
if ($unselected.length > 0 && this.options.get('tags')) {
$unselected.last().trigger('mouseenter');
} else if ($selected.length > 0) {
// Check if there are any selected options
// If there are selected options, highlight the first
$selected.first().trigger('mouseenter');
} else {
Expand Down Expand Up @@ -1799,7 +1786,7 @@ S2.define('select2/selection/multiple',[

var $rendered = this.$selection.find('.select2-selection__rendered');

Utils.appendMany($rendered, $selections);
$rendered.append($selections);
};

return MultipleSelection;
Expand Down Expand Up @@ -3337,7 +3324,7 @@ S2.define('select2/data/select',[
};

SelectAdapter.prototype.addOptions = function ($options) {
Utils.appendMany(this.$element, $options);
this.$element.append($options);
};

SelectAdapter.prototype.option = function (data) {
Expand Down Expand Up @@ -3542,7 +3529,7 @@ S2.define('select2/data/array',[
if (item.children) {
var $children = this.convertToOptions(item.children);

Utils.appendMany($option, $children);
$option.append($children);
}

$options.push($option);
Expand Down
2 changes: 1 addition & 1 deletion dist/js/select2.min.js

Large diffs are not rendered by default.

0 comments on commit 9789765

Please sign in to comment.