diff --git a/core/modules/system/js/system.es6.js b/core/modules/system/js/system.es6.js index 51007662e3c3e99f89e7f6b64a1e565f718f1ffb..3f365d1fad0792504409db1df77ec805c7dfb55b 100644 --- a/core/modules/system/js/system.es6.js +++ b/core/modules/system/js/system.es6.js @@ -23,7 +23,10 @@ attach(context) { // List of fields IDs on which to bind the event listener. // Create an array of IDs to use with jQuery. - Object.keys(drupalSettings.copyFieldValue || {}).forEach(ids.push); + Object.keys(drupalSettings.copyFieldValue || {}).forEach((element) => { + ids.push(element); + }); + if (ids.length) { // Listen to value:copy events on all dependent fields. // We have to use body and not document because of the way jQuery events diff --git a/core/modules/system/js/system.js b/core/modules/system/js/system.js index 4bcfe348ed7f0ff8823b95a217fbc9dad543583b..f23a69a93714b4ca175a739387a283551f052f57 100644 --- a/core/modules/system/js/system.js +++ b/core/modules/system/js/system.js @@ -10,7 +10,10 @@ Drupal.behaviors.copyFieldValue = { attach: function attach(context) { - Object.keys(drupalSettings.copyFieldValue || {}).forEach(ids.push); + Object.keys(drupalSettings.copyFieldValue || {}).forEach(function (element) { + ids.push(element); + }); + if (ids.length) { $('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler);