Skip to content

Commit

Permalink
Increase minimum jQuery version to latest in the 1.x series (select2#…
Browse files Browse the repository at this point in the history
…5525)

* Remove Utils.appendMany
  • Loading branch information
blikblum authored Mar 14, 2020
1 parent ab6f846 commit 4bd4bbc
Show file tree
Hide file tree
Showing 8 changed files with 11,013 additions and 9,426 deletions.
2 changes: 1 addition & 1 deletion src/js/select2/data/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ define([
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 src/js/select2/data/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ define([
};

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

SelectAdapter.prototype.option = function (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/select2/selection/multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ define([

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

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

return MultipleSelection;
Expand Down
17 changes: 0 additions & 17 deletions src/js/select2/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,6 @@ define([
});
};

// 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
2 changes: 1 addition & 1 deletion tests/integration-jq1.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="qunit-fixture"></div>

<script src="vendor/qunit-1.23.1.js" type="text/javascript"></script>
<script src="vendor/jquery-1.7.2.js" type="text/javascript"></script>
<script src="vendor/jquery-1.12.4.js" type="text/javascript"></script>
<script src="../dist/js/select2.full.js" type="text/javascript"></script>

<script src="helpers.js" type="text/javascript"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-jq1.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>

<script src="vendor/qunit-1.23.1.js" type="text/javascript"></script>
<script src="vendor/jquery-1.7.2.js" type="text/javascript"></script>
<script src="vendor/jquery-1.12.4.js" type="text/javascript"></script>
<script src="../dist/js/select2.full.js" type="text/javascript"></script>

<script src="helpers.js" type="text/javascript"></script>
Expand Down
Loading

0 comments on commit 4bd4bbc

Please sign in to comment.