From 7863eec3660c7d78f9cfd5b3eee0585975faac6e Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Fri, 3 Feb 2017 22:01:30 +0800 Subject: [PATCH] Fix "[object HTMLCollection] is not iterable!" error in some browsers --- public/js/extra.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/js/extra.js b/public/js/extra.js index 39812fd8..16235669 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -792,7 +792,8 @@ const anchorForId = id => { const linkifyAnchors = (level, containingElement) => { const headers = containingElement.getElementsByTagName(`h${level}`); - for (const header of headers) { + for (let i = 0, l = headers.length; i < l; i++) { + let header = headers[i]; if (header.getElementsByClassName("anchor").length == 0) { if (typeof header.id == "undefined" || header.id == "") { //to escape characters not allow in css and humanize