diff options
author | webchick <drupal@webchick.net> | 2018-01-03 15:25:46 -0800 |
---|---|---|
committer | webchick <drupal@webchick.net> | 2018-01-03 15:27:55 -0800 |
commit | f1e33ca3d84ac2251aed144c2587ed9eb2e578fb (patch) | |
tree | 261bda9fb2ddf66ed396db34d7a4fff373f5ec63 /core/modules/comment/js | |
parent | 9d552cad6cfbe8383b96b74ffc6176503a7b0c2e (diff) | |
download | drupal-f1e33ca3d84ac2251aed144c2587ed9eb2e578fb.tar.gz drupal-f1e33ca3d84ac2251aed144c2587ed9eb2e578fb.zip |
Issue #2925064 by drpal, dawehner, droplet, xjm, webchick, justafish: [1/2] JS codestyle: no-restricted-syntax
Diffstat (limited to 'core/modules/comment/js')
-rw-r--r-- | core/modules/comment/js/node-new-comments-link.es6.js | 6 | ||||
-rw-r--r-- | core/modules/comment/js/node-new-comments-link.js | 6 |
2 files changed, 6 insertions, 6 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 e32c38cde0c6..a2bdc35b9d72 100644 --- a/core/modules/comment/js/node-new-comments-link.es6.js +++ b/core/modules/comment/js/node-new-comments-link.es6.js @@ -149,15 +149,15 @@ * Data about new comment links indexed by nodeID. */ function render(results) { - for (const nodeID in results) { - if (results.hasOwnProperty(nodeID) && $placeholdersToUpdate.hasOwnProperty(nodeID)) { + 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]); } - } + }); } if (drupalSettings.comment && drupalSettings.comment.newCommentsLinks) { diff --git a/core/modules/comment/js/node-new-comments-link.js b/core/modules/comment/js/node-new-comments-link.js index 37fdb58c5e17..1396018a5618 100644 --- a/core/modules/comment/js/node-new-comments-link.js +++ b/core/modules/comment/js/node-new-comments-link.js @@ -70,12 +70,12 @@ } function render(results) { - for (var nodeID in results) { - if (results.hasOwnProperty(nodeID) && $placeholdersToUpdate.hasOwnProperty(nodeID)) { + Object.keys(results || {}).forEach(function (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]); } - } + }); } if (drupalSettings.comment && drupalSettings.comment.newCommentsLinks) { |