Skip to content

Commit 5ba21f0

Browse files
authored
Merge pull request #6860 from magento-lynx/jquery-upgrade
[LYNX] Jquery upgrade compatibility changes
2 parents 76ff97e + 98b3ee6 commit 5ba21f0

File tree

15 files changed

+28
-26
lines changed

15 files changed

+28
-26
lines changed

app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ Bundle.Selection.prototype = {
159159
$grid.find('.checkbox').prop({checked: false});
160160
161161
var checkRowBySku = function (sku) {
162-
sku = $.trim(sku);
162+
sku = sku.trim();
163163
$grid.find('.sku').filter(function () {
164-
return $.trim($(this).text()) == sku;
164+
return $(this).text().trim() == sku;
165165
}).closest('tr').find('.checkbox').prop({checked: true});
166166
};
167167
$.each(bSelection.gridSelection.values().pop().toArray(), function () {

app/code/Magento/Bundle/view/adminhtml/web/js/bundle-product.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ define([
146146

147147
if ($(this).is(':checked')) {
148148
selectedProductList[$(this).val()] = {
149-
name: $.trim(tr.find('.col-name').html()),
150-
sku: $.trim(tr.find('.col-sku').html()),
149+
name: tr.find('.col-name').html().trim(),
150+
sku: tr.find('.col-sku').html().trim(),
151151
'product_id': $(this).val(),
152152
'option_id': $('bundle_selection_id_' + optionIndex).val(),
153153
'selection_price_value': 0,
@@ -186,7 +186,7 @@ define([
186186
});
187187
bSelection.gridRemoval.each(function (pair) {
188188
$optionBox.find('.col-sku').filter(function () {
189-
return $.trim($(this).text()) === pair.key; // find row by SKU
189+
return $(this).text().trim() === pair.key; // find row by SKU
190190
}).closest('tr').find('button.delete').trigger('click');
191191
});
192192
widget.refreshSortableElements();

app/code/Magento/Bundle/view/frontend/web/js/product-summary.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ define([
7777
.closest(this.options.summaryContainer)
7878
.find(this.options.templates.summaryBlock)
7979
.html();
80-
template = mageTemplate($.trim(template), {
80+
template = mageTemplate(template.trim(), {
8181
data: {
8282
_label_: this.cache.currentElement.options[key].title
8383
}
@@ -107,7 +107,7 @@ define([
107107
.closest(this.options.summaryContainer)
108108
.find(this.options.templates.optionBlock)
109109
.html();
110-
template = mageTemplate($.trim(template), {
110+
template = mageTemplate(template.trim(), {
111111
data: {
112112
_quantity_: this.cache.currentElement.options[this.cache.currentKey].selections[optionIndex].qty,
113113
_label_: this.cache.currentElement.options[this.cache.currentKey].selections[optionIndex].name

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ define([
104104
}
105105
});
106106

107-
if ($.isArray(addrs.street)) {
107+
if (Array.isArray(addrs.street)) {
108108
streetObject = {};
109109
addrs.street.forEach(function (value, index) {
110110
streetObject[index] = value;
@@ -113,7 +113,7 @@ define([
113113
}
114114

115115
//jscs:disable requireCamelCaseOrUpperCaseIdentifiers
116-
if ($.isArray(addrs.customAttributes)) {
116+
if (Array.isArray(addrs.customAttributes)) {
117117
customAttributesObject = {};
118118
addrs.customAttributes.forEach(function (value) {
119119
customAttributesObject[value.attribute_code] = value.value;

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/attributes_values.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ define([
106106
errorOption,
107107
allOptions = [];
108108

109-
newOption.label = $.trim(newOption.label);
109+
newOption.label = newOption.label.trim();
110110

111111
if (_.isEmpty(newOption.label)) {
112112
return false;

app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ define([
159159
product.id = element.val();
160160
product.qty = 0;
161161
element.closest('[data-role=row]').find('[data-column]').each(function (index, el) {
162-
product[$(el).data('column')] = $.trim($(el).text());
162+
product[$(el).data('column')] = $(el).text().trim();
163163
});
164164
selectedProductList[product.id] = product;
165165
} else {

app/code/Magento/PageCache/view/frontend/web/js/page-cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ define([
6565
contents = function (elem) {
6666
return $.map(elem, function (el) {
6767
try {
68-
return $.nodeName(el, 'iframe') ?
68+
return el.nodeName.toLowerCase() === 'iframe' ?
6969
el.contentDocument || (el.contentWindow ? el.contentWindow.document : []) :
7070
$.merge([], el.childNodes);
7171
} catch (e) {

app/code/Magento/Paypal/view/frontend/web/js/order-review.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ define([
285285
isChecked = $(this.options.billingAsShippingSelector).is(':checked');
286286
formData = null;
287287
callBackResponseHandler = null;
288-
shippingMethod = $.trim($(this.options.shippingSelector).val());
288+
shippingMethod = $(this.options.shippingSelector).val().trim();
289289
this._shippingTobilling();
290290

291291
if (url && resultId && shippingMethod) {
@@ -358,7 +358,7 @@ define([
358358
* Actions on change Shipping Address data
359359
*/
360360
_onShippingChange: function () {
361-
if (this.triggerPropertyChange && $.trim($(this.options.shippingSelector).val())) {
361+
if (this.triggerPropertyChange && $(this.options.shippingSelector).val().trim()) {
362362
this.element.find(this.options.shippingSelector).hide().end()
363363
.find(this.options.shippingSelector + '_update').show();
364364
}

app/code/Magento/ProductVideo/view/adminhtml/web/js/new-video-dialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ define([
628628
}).css('display', 'none');
629629
fu.parent().append(tmpInput);
630630
fileUploader = $(tmpInput).fileupload();
631-
fileUploader.fileupload('send', data).success(function (result, textStatus, jqXHR) {
631+
fileUploader.fileupload('send', data).done(function (result, textStatus, jqXHR) {
632632
tmpInput.remove();
633633
callback.call(null, result, textStatus, jqXHR);
634634
});

app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ define([
106106
$title = $element.find('.title');
107107
$corner = $element.find('.corner');
108108

109-
$this.hover(function () {
109+
$this.on('mouseenter', function () {
110110
if (!$this.hasClass('disabled')) {
111111
timer = setTimeout(
112112
function () {
@@ -168,7 +168,9 @@ define([
168168
$widget.options.delay
169169
);
170170
}
171-
}, function () {
171+
});
172+
173+
$this.on('mouseleave', function () {
172174
$element.hide();
173175
clearTimeout(timer);
174176
});

0 commit comments

Comments
 (0)