From cbe7192928fdb3817eb312e42a7d228dc457e08a Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Wed, 4 Apr 2018 18:34:43 -0700 Subject: [PATCH] use regular for loop for html dom element collection --- routes/_components/status/StatusContent.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routes/_components/status/StatusContent.html b/routes/_components/status/StatusContent.html index baf4e9b8..bfaba0e9 100644 --- a/routes/_components/status/StatusContent.html +++ b/routes/_components/status/StatusContent.html @@ -102,7 +102,8 @@ if (originalStatus.tags && originalStatus.tags.length) { let anchorTags = node.querySelectorAll('a[class~=hashtag][href^=http]') for (let tag of originalStatus.tags) { - for (let anchorTag of anchorTags) { + for (let i = 0, len = anchorTags.length; i < len; i++) { + let anchorTag = anchorTags[i] if (anchorTag.getAttribute('href').endsWith(`/tags/${tag.name}`)) { anchorTag.setAttribute('href', `/tags/${tag.name}`) anchorTag.setAttribute('focus-key', `status-content-link-${uuid}-${++count}`) @@ -115,7 +116,8 @@ if (originalStatus.mentions && originalStatus.mentions.length) { let anchorTags = node.querySelectorAll('a[class~=mention][href^=http]') for (let mention of originalStatus.mentions) { - for (let anchorTag of anchorTags) { + for (let i = 0, len = anchorTags.length; i < len; i++) { + let anchorTag = anchorTags[i] if (anchorTag.getAttribute('href') === mention.url) { anchorTag.setAttribute('href', `/accounts/${mention.id}`) anchorTag.setAttribute('title', `@${mention.acct}`) @@ -127,7 +129,8 @@ } } let externalLinks = node.querySelectorAll('a[rel="nofollow noopener"]') - for (let link of externalLinks) { + for (let i = 0, len = externalLinks.length; i < len; i++) { + let link = externalLinks[i] link.setAttribute('title', link.getAttribute('href')) } stop('hydrateContent')