Skip to content

Commit 659263a

Browse files
authored
MC-41898: Fix jQuery.trim() (#36)
- Replace functions
1 parent a7ab44f commit 659263a

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
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/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/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/Ui/view/base/web/js/block-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ define([
2020

2121
templateLoader.loadTemplate(blockLoaderTemplatePath).done(function (blockLoaderTemplate) {
2222
loaderImageHref.done(function (loaderHref) {
23-
blockLoader = template($.trim(blockLoaderTemplate), {
23+
blockLoader = template(blockLoaderTemplate.trim(), {
2424
loaderImageHref: loaderHref
2525
});
2626
blockLoader = $(blockLoader);

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ define([
458458
return false;
459459
}
460460

461-
pass = $.trim(value);
461+
pass = value.trim();
462462

463463
if (!pass.length) {
464464
return true;
@@ -476,7 +476,7 @@ define([
476476
return false;
477477
}
478478

479-
pass = $.trim(value);
479+
pass = value.trim();
480480

481481
if (pass.length === 0) {
482482
return true;
@@ -500,7 +500,7 @@ define([
500500
counter = 0,
501501
passwordMinLength = $(elm).data('password-min-length'),
502502
passwordMinCharacterSets = $(elm).data('password-min-character-sets'),
503-
pass = $.trim(v),
503+
pass = v.trim(),
504504
result = pass.length >= passwordMinLength;
505505

506506
if (result === false) {

lib/web/mage/backend/suggest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ define([
148148
* @private
149149
*/
150150
_value: function () {
151-
return $.trim(this.element[this.element.is(':input') ? 'val' : 'text']());
151+
return this.element[this.element.is(':input') ? 'val' : 'text']().trim();
152152
},
153153

154154
/**

lib/web/mage/multiselect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ define([
166166
* @return {String}
167167
*/
168168
getSearchCriteria: function () {
169-
return $.trim(this.$input.val());
169+
return this.$input.val().trim();
170170
},
171171

172172
/**

0 commit comments

Comments
 (0)