Skip to content

Commit ae40e98

Browse files
committed
Merge remote-tracking branch 'goinc/MAGETWO-50875' into pr-539
2 parents d685149 + f74c3b4 commit ae40e98

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/wizard.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ $currencySymbol = $block->getCurrencySymbol();
6060
}
6161
</script>
6262
<script>
63-
require(['jquery'], function ($) {
63+
require(['jquery', 'mage/apply/main'], function ($, main) {
64+
main.apply();
6465
$('.<?= /* @noEscape */ $block->getData('config/dataScope') ?>[data-role=step-wizard-dialog]').applyBindings();
6566
$('.<?= /* @noEscape */ $block->getData('config/dataScope') ?>[data-role=product-variations-matrix]').applyBindings();
6667
})

app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/bind-html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ define([
3939
function applyComponents(el, ctx) {
4040
ko.utils.arrayForEach(el.childNodes, ko.cleanNode);
4141
ko.applyBindingsToDescendants(ctx, el);
42-
mage.apply();
42+
mage.apply(el);
4343
}
4444

4545
ko.bindingHandlers.bindHtml = {

lib/web/mage/apply/main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ define([
5656
/**
5757
* Initializes components assigned to HTML elements via [data-mage-init].
5858
*
59+
* @param {HTMLElement} context - Element of context to search
5960
* @example Sample 'data-mage-init' declaration.
6061
* data-mage-init='{"path/to/component": {"foo": "bar"}}'
6162
*/
62-
apply: function () {
63-
var virtuals = processScripts(),
64-
nodes = document.querySelectorAll(nodeSelector);
63+
apply: function (context) {
64+
var el = _.isElement(context) ? context : document,
65+
virtuals = processScripts(el),
66+
nodes = el.querySelectorAll(nodeSelector);
6567

6668
_.toArray(nodes)
6769
.map(getData)

lib/web/mage/apply/scripts.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ define([
9191
* to a 'data-mage-init' attribute of an elemennt found by provided selector.
9292
* Note: All found script nodes will be removed from DOM.
9393
*
94+
* @param {HTMLElement} context - Element of context to search
9495
* @returns {Array} An array of components not assigned to the specific element.
9596
*
9697
* @example Sample declaration.
@@ -109,8 +110,9 @@ define([
109110
* }
110111
* }
111112
*/
112-
return function () {
113-
var nodes = document.querySelectorAll(scriptSelector);
113+
return function (context) {
114+
var el = _.isElement(context) ? context : document,
115+
nodes = el.querySelectorAll(scriptSelector);
114116

115117
_.toArray(nodes)
116118
.map(getNodeData)

0 commit comments

Comments
 (0)