summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/system/js/system.js
diff options
context:
space:
mode:
authorAlex Pott <alex.a.pott@googlemail.com>2020-01-28 11:36:14 +0000
committerAlex Pott <alex.a.pott@googlemail.com>2020-01-28 11:36:14 +0000
commit2dadb738bfd48510db2174323528fe769731c05a (patch)
treef6319d9bfa9af8b41dc0ca7c187bef1eaf17aee4 /core/modules/system/js/system.js
parent09b78ffb1bc1bb62d21fb3abb85e1349a674597a (diff)
downloaddrupal-2dadb738bfd48510db2174323528fe769731c05a.tar.gz
drupal-2dadb738bfd48510db2174323528fe769731c05a.zip
Issue #3101543 by lauriii, bnjmnm, ravi.shankar: Update core JavaScript dependencies listed in package.json
Diffstat (limited to 'core/modules/system/js/system.js')
-rw-r--r--core/modules/system/js/system.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/modules/system/js/system.js b/core/modules/system/js/system.js
index f23a69a93714..f8cbd41f6180 100644
--- a/core/modules/system/js/system.js
+++ b/core/modules/system/js/system.js
@@ -7,7 +7,6 @@
(function ($, Drupal, drupalSettings) {
var ids = [];
-
Drupal.behaviors.copyFieldValue = {
attach: function attach(context) {
Object.keys(drupalSettings.copyFieldValue || {}).forEach(function (element) {
@@ -16,18 +15,18 @@
if (ids.length) {
$('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler);
-
- $('#' + ids.join(', #')).once('copy-field-values').on('blur', this.valueSourceBlurHandler);
+ $("#".concat(ids.join(', #'))).once('copy-field-values').on('blur', this.valueSourceBlurHandler);
}
},
detach: function detach(context, settings, trigger) {
if (trigger === 'unload' && ids.length) {
$('body').removeOnce('copy-field-values').off('value:copy');
- $('#' + ids.join(', #')).removeOnce('copy-field-values').off('blur');
+ $("#".concat(ids.join(', #'))).removeOnce('copy-field-values').off('blur');
}
},
valueTargetCopyHandler: function valueTargetCopyHandler(e, value) {
var $target = $(e.target);
+
if ($target.val() === '') {
$target.val(value);
}
@@ -35,7 +34,7 @@
valueSourceBlurHandler: function valueSourceBlurHandler(e) {
var value = $(e.target).val();
var targetIds = drupalSettings.copyFieldValue[e.target.id];
- $('#' + targetIds.join(', #')).trigger('value:copy', value);
+ $("#".concat(targetIds.join(', #'))).trigger('value:copy', value);
}
};
})(jQuery, Drupal, drupalSettings); \ No newline at end of file