From 8c62a32c2da35b38d60a7930863a65ae820b41b4 Mon Sep 17 00:00:00 2001 From: Lauri Eskola Date: Fri, 28 Jan 2022 11:53:59 +0200 Subject: Issue #3239123 by hooroomoo, bnjmnm, nod_: Refactor (if feasible) uses of the jQuery text function to use vanillaJS --- core/modules/comment/js/node-new-comments-link.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/modules/comment/js/node-new-comments-link.js') diff --git a/core/modules/comment/js/node-new-comments-link.js b/core/modules/comment/js/node-new-comments-link.js index ebac99a578f..6577421f21d 100644 --- a/core/modules/comment/js/node-new-comments-link.js +++ b/core/modules/comment/js/node-new-comments-link.js @@ -44,8 +44,11 @@ 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')).removeClass('hidden'); - show($placeholdersToUpdate[nodeID]); + 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($placeholderItem); } }); } -- cgit v1.2.3