diff options
author | Lauri Eskola <lauri.eskola@acquia.com> | 2022-01-28 11:53:59 +0200 |
---|---|---|
committer | Lauri Eskola <lauri.eskola@acquia.com> | 2022-01-28 11:53:59 +0200 |
commit | 8c62a32c2da35b38d60a7930863a65ae820b41b4 (patch) | |
tree | 7b1ccfc0bf843e8d1ddbc7b49a0d4dcdfe51dc09 /core/modules/system/js/system.date.es6.js | |
parent | 6b8783b23aece75da1cbc6eb59f1d2c6adfad2a1 (diff) | |
download | drupal-8c62a32c2da35b38d60a7930863a65ae820b41b4.tar.gz drupal-8c62a32c2da35b38d60a7930863a65ae820b41b4.zip |
Issue #3239123 by hooroomoo, bnjmnm, nod_: Refactor (if feasible) uses of the jQuery text function to use vanillaJS
Diffstat (limited to 'core/modules/system/js/system.date.es6.js')
-rw-r--r-- | core/modules/system/js/system.date.es6.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/modules/system/js/system.date.es6.js b/core/modules/system/js/system.date.es6.js index 8412bd07f021..2ea0af1d95a0 100644 --- a/core/modules/system/js/system.date.es6.js +++ b/core/modules/system/js/system.date.es6.js @@ -32,9 +32,6 @@ return; } - const $target = $(target); - const $preview = $target.find('em'); - /** * Event handler that replaces date characters with value. * @@ -47,8 +44,14 @@ dateFormats[key] ? dateFormats[key] : value, ); - $preview.text(dateString); - $target.toggleClass('js-hide', !dateString.length); + // Set date preview. + target.forEach((item) => { + item.querySelectorAll('em').forEach((em) => { + em.textContent = dateString; + }); + }); + + $(target).toggleClass('js-hide', !dateString.length); } /** |