Skip to content

Commit 8e60c10

Browse files
author
Hwashiang Yu
committed
MC-3473: Create widget on frontend and apply width
- Updated syntax to use jQuery shorthands
1 parent 543ed5f commit 8e60c10

File tree

1 file changed

+4
-6
lines changed
  • app/code/Magento/PageBuilder/view/frontend/web/js/content-type/buttons/appearance/inline

1 file changed

+4
-6
lines changed

app/code/Magento/PageBuilder/view/frontend/web/js/content-type/buttons/appearance/inline/widget.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@ define([
1616
var buttonMinWidth = 0;
1717

1818
buttonList.each(function () {
19-
var buttonWidth = this.querySelector('[data-element="link"]').offsetWidth;
19+
var buttonWidth = this.offsetWidth;
2020

2121
if (buttonWidth > buttonMinWidth) {
2222
buttonMinWidth = buttonWidth;
2323
}
2424
});
25-
buttonList.each(function () {
26-
this.querySelector('[data-element="link"]').style.width = buttonMinWidth + 'px';
27-
});
25+
buttonList.css('width', buttonMinWidth);
2826
};
2927

3028
return function (config, element) {
3129
var $element = $(element);
3230

33-
if ($element.attr('data-same-width') === '1') {
34-
equalizeButtonWidth($element.children());
31+
if ($element.data('sameWidth') === '1') {
32+
equalizeButtonWidth($element.find('[data-element="link"]'));
3533
}
3634
};
3735
});

0 commit comments

Comments
 (0)