X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Fjs%2Fnode-new-comments-link.js;h=1396018a561872b3a47ff5ac8993b0c3d03e9c39;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=37fdb58c5e17db80e08fc76de9a0698f80bf4562;hpb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;p=yaffs-website diff --git a/web/core/modules/comment/js/node-new-comments-link.js b/web/core/modules/comment/js/node-new-comments-link.js index 37fdb58c5..1396018a5 100644 --- a/web/core/modules/comment/js/node-new-comments-link.js +++ b/web/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) {