summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/comment/js/node-new-comments-link.es6.js
diff options
context:
space:
mode:
authorLauri Eskola <lauri.eskola@acquia.com>2022-01-28 11:53:59 +0200
committerLauri Eskola <lauri.eskola@acquia.com>2022-01-28 11:53:59 +0200
commit8c62a32c2da35b38d60a7930863a65ae820b41b4 (patch)
tree7b1ccfc0bf843e8d1ddbc7b49a0d4dcdfe51dc09 /core/modules/comment/js/node-new-comments-link.es6.js
parent6b8783b23aece75da1cbc6eb59f1d2c6adfad2a1 (diff)
downloaddrupal-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/comment/js/node-new-comments-link.es6.js')
-rw-r--r--core/modules/comment/js/node-new-comments-link.es6.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/modules/comment/js/node-new-comments-link.es6.js b/core/modules/comment/js/node-new-comments-link.es6.js
index add49dd29462..074864b4a8ef 100644
--- a/core/modules/comment/js/node-new-comments-link.es6.js
+++ b/core/modules/comment/js/node-new-comments-link.es6.js
@@ -115,17 +115,17 @@
function render(results) {
Object.keys(results || {}).forEach((nodeID) => {
if ($placeholdersToUpdate.hasOwnProperty(nodeID)) {
- $placeholdersToUpdate[nodeID]
- .attr('href', results[nodeID].first_new_comment_link)
- .text(
- Drupal.formatPlural(
- results[nodeID].new_comment_count,
- '1 new comment',
- '@count new comments',
- ),
- )
+ const $placeholderItem = $placeholdersToUpdate[nodeID];
+ const result = results[nodeID];
+ $placeholderItem[0].textContent = Drupal.formatPlural(
+ result.new_comment_count,
+ '1 new comment',
+ '@count new comments',
+ );
+ $placeholderItem
+ .attr('href', result.first_new_comment_link)
.removeClass('hidden');
- show($placeholdersToUpdate[nodeID]);
+ show($placeholderItem);
}
});
}