X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Fjs%2Fsystem.es6.js;fp=web%2Fcore%2Fmodules%2Fsystem%2Fjs%2Fsystem.es6.js;h=62b415dad9a8fcf7db211b5fb1598e7f6e0269ee;hp=3f365d1fad0792504409db1df77ec805c7dfb55b;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/system/js/system.es6.js b/web/core/modules/system/js/system.es6.js index 3f365d1fa..62b415dad 100644 --- a/web/core/modules/system/js/system.es6.js +++ b/web/core/modules/system/js/system.es6.js @@ -3,7 +3,7 @@ * System behaviors. */ -(function ($, Drupal, drupalSettings) { +(function($, Drupal, drupalSettings) { // Cache IDs in an array for ease of use. const ids = []; @@ -23,7 +23,7 @@ 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((element) => { + Object.keys(drupalSettings.copyFieldValue || {}).forEach(element => { ids.push(element); }); @@ -31,15 +31,23 @@ // Listen to value:copy events on all dependent fields. // We have to use body and not document because of the way jQuery events // bubble up the DOM tree. - $('body').once('copy-field-values').on('value:copy', this.valueTargetCopyHandler); + $('body') + .once('copy-field-values') + .on('value:copy', this.valueTargetCopyHandler); // Listen on all source elements. - $(`#${ids.join(', #')}`).once('copy-field-values').on('blur', this.valueSourceBlurHandler); + $(`#${ids.join(', #')}`) + .once('copy-field-values') + .on('blur', this.valueSourceBlurHandler); } }, 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'); + $('body') + .removeOnce('copy-field-values') + .off('value:copy'); + $(`#${ids.join(', #')}`) + .removeOnce('copy-field-values') + .off('blur'); } }, @@ -73,4 +81,4 @@ $(`#${targetIds.join(', #')}`).trigger('value:copy', value); }, }; -}(jQuery, Drupal, drupalSettings)); +})(jQuery, Drupal, drupalSettings);