Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / comment / js / node-new-comments-link.js
index 37fdb58c5e17db80e08fc76de9a0698f80bf4562..1396018a561872b3a47ff5ac8993b0c3d03e9c39 100644 (file)
     }
 
     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) {