| @@ -1,11 +1,9 @@ | ||
| 1 | 1 | /*! |
| 2 | 2 | * Select2 4.0.6-rc.1 |
| 3 | 3 | * https://select2.github.io |
| 4 | 4 | * |
| 5 | - * With a fix by Elementor team at lines 4329, 5449. | |
| 6 | - * Also deprecated jQuery features fixed at lines: 1477, 1479, 1617, 2111, 2113, 3244, 3548, 3573, 3632, 3708, 3801, | |
| 7 | - * 4047, 4050, 4058, 4063, 4873, 4936, 5395, 5693, 5772, 5785, 5826, 5852, 5883, 5909, 5956, 6103, 6346, 6350. | |
| 5 | + * With a fix by Elementor team at line 4329 and 5449 | |
| 8 | 6 | * |
| 9 | 7 | * Released under the MIT license |
| 10 | 8 | * https://github.com/select2/select2/blob/master/LICENSE.md |
| 11 | 9 | */ |
| @@ -1473,11 +1471,11 @@ | ||
| 1473 | 1471 | self.$selection.attr('aria-expanded', 'false'); |
| 1474 | 1472 | self.$selection.removeAttr('aria-activedescendant'); |
| 1475 | 1473 | self.$selection.removeAttr('aria-owns'); |
| 1476 | 1474 | |
| 1477 | - self.$selection.trigger('focus'); | |
| 1475 | + self.$selection.focus(); | |
| 1478 | 1476 | window.setTimeout(function () { |
| 1479 | - self.$selection.trigger('focus'); | |
| 1477 | + self.$selection.focus(); | |
| 1480 | 1478 | }, 0); |
| 1481 | 1479 | |
| 1482 | 1480 | self._detachCloseHandler(container); |
| 1483 | 1481 | }); |
| @@ -1613,9 +1611,9 @@ | ||
| 1613 | 1611 | }); |
| 1614 | 1612 | |
| 1615 | 1613 | container.on('focus', function (evt) { |
| 1616 | 1614 | if (!container.isOpen()) { |
| 1617 | - self.$selection.trigger('focus'); | |
| 1615 | + self.$selection.focus(); | |
| 1618 | 1616 | } |
| 1619 | 1617 | }); |
| 1620 | 1618 | }; |
| 1621 | 1619 | |
| @@ -2107,11 +2105,11 @@ | ||
| 2107 | 2105 | if (searchHadFocus) { |
| 2108 | 2106 | var isTagInput = this.$element.find('[data-select2-tag]').length; |
| 2109 | 2107 | if (isTagInput) { |
| 2110 | 2108 | // fix IE11 bug where tag input lost focus |
| 2111 | - this.$element.trigger('focus'); | |
| 2109 | + this.$element.focus(); | |
| 2112 | 2110 | } else { |
| 2113 | - this.$search.trigger('focus'); | |
| 2111 | + this.$search.focus(); | |
| 2114 | 2112 | } |
| 2115 | 2113 | } |
| 2116 | 2114 | }; |
| 2117 | 2115 | |
| @@ -3544,9 +3542,9 @@ | ||
| 3544 | 3542 | var self = this; |
| 3545 | 3543 | |
| 3546 | 3544 | if (this._request != null) { |
| 3547 | 3545 | // JSONP requests cannot always be aborted |
| 3548 | - if (typeof this._request.abort === 'function') { | |
| 3546 | + if ($.isFunction(this._request.abort)) { | |
| 3549 | 3547 | this._request.abort(); |
| 3550 | 3548 | } |
| 3551 | 3549 | |
| 3552 | 3550 | this._request = null; |
| @@ -3569,9 +3567,9 @@ | ||
| 3569 | 3567 | var results = self.processResults(data, params); |
| 3570 | 3568 | |
| 3571 | 3569 | if (self.options.get('debug') && window.console && console.error) { |
| 3572 | 3570 | // Check to make sure that the response included a `results` key. |
| 3573 | - if (!results || !results.results || !Array.isArray(results.results)) { | |
| 3571 | + if (!results || !results.results || !$.isArray(results.results)) { | |
| 3574 | 3572 | console.error( |
| 3575 | 3573 | 'Select2: The AJAX results did not return an array in the ' + |
| 3576 | 3574 | '`results` key of the response.' |
| 3577 | 3575 | ); |
| @@ -3628,9 +3626,9 @@ | ||
| 3628 | 3626 | } |
| 3629 | 3627 | |
| 3630 | 3628 | decorated.call(this, $element, options); |
| 3631 | 3629 | |
| 3632 | - if (Array.isArray(tags)) { | |
| 3630 | + if ($.isArray(tags)) { | |
| 3633 | 3631 | for (var t = 0; t < tags.length; t++) { |
| 3634 | 3632 | var tag = tags[t]; |
| 3635 | 3633 | var item = this._normalizeItem(tag); |
| 3636 | 3634 | |
| @@ -3704,9 +3702,9 @@ | ||
| 3704 | 3702 | decorated.call(this, params, wrapper); |
| 3705 | 3703 | }; |
| 3706 | 3704 | |
| 3707 | 3705 | Tags.prototype.createTag = function (decorated, params) { |
| 3708 | - var term = (params?.term ?? '').trim(); | |
| 3706 | + var term = $.trim(params.term); | |
| 3709 | 3707 | |
| 3710 | 3708 | if (term === '') { |
| 3711 | 3709 | return null; |
| 3712 | 3710 | } |
| @@ -3797,9 +3795,9 @@ | ||
| 3797 | 3795 | if (tokenData.term !== params.term) { |
| 3798 | 3796 | // Replace the search term if we have the search box |
| 3799 | 3797 | if (this.$search.length) { |
| 3800 | 3798 | this.$search.val(tokenData.term); |
| 3801 | - this.$search.trigger('focus'); | |
| 3799 | + this.$search.focus(); | |
| 3802 | 3800 | } |
| 3803 | 3801 | |
| 3804 | 3802 | params.term = tokenData.term; |
| 3805 | 3803 | } |
| @@ -4043,12 +4041,12 @@ | ||
| 4043 | 4041 | |
| 4044 | 4042 | container.on('open', function () { |
| 4045 | 4043 | self.$search.attr('tabindex', 0); |
| 4046 | 4044 | |
| 4047 | - self.$search.trigger('focus'); | |
| 4045 | + self.$search.focus(); | |
| 4048 | 4046 | |
| 4049 | 4047 | window.setTimeout(function () { |
| 4050 | - self.$search.trigger('focus'); | |
| 4048 | + self.$search.focus(); | |
| 4051 | 4049 | }, 0); |
| 4052 | 4050 | }); |
| 4053 | 4051 | |
| 4054 | 4052 | container.on('close', function () { |
| @@ -4054,14 +4052,14 @@ | ||
| 4054 | 4052 | container.on('close', function () { |
| 4055 | 4053 | self.$search.attr('tabindex', -1); |
| 4056 | 4054 | |
| 4057 | 4055 | self.$search.val(''); |
| 4058 | - self.$search.trigger('blur'); | |
| 4056 | + self.$search.blur(); | |
| 4059 | 4057 | }); |
| 4060 | 4058 | |
| 4061 | 4059 | container.on('focus', function () { |
| 4062 | 4060 | if (!container.isOpen()) { |
| 4063 | - self.$search.trigger('focus'); | |
| 4061 | + self.$search.focus(); | |
| 4064 | 4062 | } |
| 4065 | 4063 | }); |
| 4066 | 4064 | |
| 4067 | 4065 | container.on('results:all', function (params) { |
| @@ -4869,9 +4867,9 @@ | ||
| 4869 | 4867 | options.language = [options.language]; |
| 4870 | 4868 | } |
| 4871 | 4869 | } |
| 4872 | 4870 | |
| 4873 | - if (Array.isArray(options.language)) { | |
| 4871 | + if ($.isArray(options.language)) { | |
| 4874 | 4872 | var languages = new Translation(); |
| 4875 | 4873 | options.language.push('en'); |
| 4876 | 4874 | |
| 4877 | 4875 | var languageNames = options.language; |
| @@ -4932,9 +4930,9 @@ | ||
| 4932 | 4930 | } |
| 4933 | 4931 | |
| 4934 | 4932 | function matcher (params, data) { |
| 4935 | 4933 | // Always return the object if there is nothing to compare |
| 4936 | - if ((params?.term ?? '').trim() === '') { | |
| 4934 | + if ($.trim(params.term) === '') { | |
| 4937 | 4935 | return data; |
| 4938 | 4936 | } |
| 4939 | 4937 | |
| 4940 | 4938 | // Do a recursive check for options with children |
| @@ -5689,9 +5687,9 @@ | ||
| 5689 | 5687 | } |
| 5690 | 5688 | |
| 5691 | 5689 | var newVal = args[0]; |
| 5692 | 5690 | |
| 5693 | - if (Array.isArray(newVal)) { | |
| 5691 | + if ($.isArray(newVal)) { | |
| 5694 | 5692 | newVal = $.map(newVal, function (obj) { |
| 5695 | 5693 | return obj.toString(); |
| 5696 | 5694 | }); |
| 5697 | 5695 | } |
| @@ -5768,9 +5766,9 @@ | ||
| 5768 | 5766 | ], function ($) { |
| 5769 | 5767 | function syncCssClasses ($dest, $src, adapter) { |
| 5770 | 5768 | var classes, replacements = [], adapted; |
| 5771 | 5769 | |
| 5772 | - classes = ($dest?.attr('class') ?? '').trim(); | |
| 5770 | + classes = $.trim($dest.attr('class')); | |
| 5773 | 5771 | |
| 5774 | 5772 | if (classes) { |
| 5775 | 5773 | classes = '' + classes; // for IE which returns object |
| 5776 | 5774 | |
| @@ -5781,9 +5779,9 @@ | ||
| 5781 | 5779 | } |
| 5782 | 5780 | }); |
| 5783 | 5781 | } |
| 5784 | 5782 | |
| 5785 | - classes = ($src?.attr('class') ?? '').trim(); | |
| 5783 | + classes = $.trim($src.attr('class')); | |
| 5786 | 5784 | |
| 5787 | 5785 | if (classes) { |
| 5788 | 5786 | classes = '' + classes; // for IE which returns object |
| 5789 | 5787 | |
| @@ -5822,9 +5820,9 @@ | ||
| 5822 | 5820 | var $container = decorated.call(this); |
| 5823 | 5821 | |
| 5824 | 5822 | var containerCssClass = this.options.get('containerCssClass') || ''; |
| 5825 | 5823 | |
| 5826 | - if (typeof containerCssClass === 'function') { | |
| 5824 | + if ($.isFunction(containerCssClass)) { | |
| 5827 | 5825 | containerCssClass = containerCssClass(this.$element); |
| 5828 | 5826 | } |
| 5829 | 5827 | |
| 5830 | 5828 | var containerCssAdapter = this.options.get('adaptContainerCssClass'); |
| @@ -5848,9 +5846,9 @@ | ||
| 5848 | 5846 | } |
| 5849 | 5847 | |
| 5850 | 5848 | var containerCss = this.options.get('containerCss') || {}; |
| 5851 | 5849 | |
| 5852 | - if (typeof containerCss === 'function') { | |
| 5850 | + if ($.isFunction(containerCss)) { | |
| 5853 | 5851 | containerCss = containerCss(this.$element); |
| 5854 | 5852 | } |
| 5855 | 5853 | |
| 5856 | 5854 | CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter); |
| @@ -5879,9 +5877,9 @@ | ||
| 5879 | 5877 | var $dropdown = decorated.call(this); |
| 5880 | 5878 | |
| 5881 | 5879 | var dropdownCssClass = this.options.get('dropdownCssClass') || ''; |
| 5882 | 5880 | |
| 5883 | - if (typeof dropdownCssClass === 'function') { | |
| 5881 | + if ($.isFunction(dropdownCssClass)) { | |
| 5884 | 5882 | dropdownCssClass = dropdownCssClass(this.$element); |
| 5885 | 5883 | } |
| 5886 | 5884 | |
| 5887 | 5885 | var dropdownCssAdapter = this.options.get('adaptDropdownCssClass'); |
| @@ -5905,9 +5903,9 @@ | ||
| 5905 | 5903 | } |
| 5906 | 5904 | |
| 5907 | 5905 | var dropdownCss = this.options.get('dropdownCss') || {}; |
| 5908 | 5906 | |
| 5909 | - if (typeof dropdownCss === 'function') { | |
| 5907 | + if ($.isFunction(dropdownCss)) { | |
| 5910 | 5908 | dropdownCss = dropdownCss(this.$element); |
| 5911 | 5909 | } |
| 5912 | 5910 | |
| 5913 | 5911 | CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter); |
| @@ -5952,9 +5950,9 @@ | ||
| 5952 | 5950 | |
| 5953 | 5951 | this.initSelection.call(null, this.$element, function (data) { |
| 5954 | 5952 | self._isInitialized = true; |
| 5955 | 5953 | |
| 5956 | - if (!Array.isArray(data)) { | |
| 5954 | + if (!$.isArray(data)) { | |
| 5957 | 5955 | data = [data]; |
| 5958 | 5956 | } |
| 5959 | 5957 | |
| 5960 | 5958 | callback(data); |
| @@ -6099,9 +6097,9 @@ | ||
| 6099 | 6097 | function oldMatcher (matcher) { |
| 6100 | 6098 | function wrappedMatcher (params, data) { |
| 6101 | 6099 | var match = $.extend(true, {}, data); |
| 6102 | 6100 | |
| 6103 | - if (params.term == null || (params?.term ?? '').trim() === '') { | |
| 6101 | + if (params.term == null || $.trim(params.term) === '') { | |
| 6104 | 6102 | return match; |
| 6105 | 6103 | } |
| 6106 | 6104 | |
| 6107 | 6105 | if (data.children) { |
| @@ -6342,13 +6340,13 @@ | ||
| 6342 | 6340 | }; |
| 6343 | 6341 | |
| 6344 | 6342 | $.fn.extend({ |
| 6345 | 6343 | mousewheel: function(fn) { |
| 6346 | - return fn ? this.on('mousewheel', fn) : this.trigger('mousewheel'); | |
| 6344 | + return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); | |
| 6347 | 6345 | }, |
| 6348 | 6346 | |
| 6349 | 6347 | unmousewheel: function(fn) { |
| 6350 | - return this.off('mousewheel', fn); | |
| 6348 | + return this.unbind('mousewheel', fn); | |
| 6351 | 6349 | } |
| 6352 | 6350 | }); |
| 6353 | 6351 | |
| 6354 | 6352 | |