summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorWu Cheng-Han2017-02-03 22:01:30 +0800
committerWu Cheng-Han2017-02-03 22:01:30 +0800
commit7863eec3660c7d78f9cfd5b3eee0585975faac6e (patch)
treeb44c28cebc2dad5c96b3b4720c32d868d4d87711 /public/js/extra.js
parent0a3baec5b6bf6340fb7dfee3dce18807b01acfa6 (diff)
Fix "[object HTMLCollection] is not iterable!" error in some browsers
Diffstat (limited to '')
-rw-r--r--public/js/extra.js3
1 files changed, 2 insertions, 1 deletions
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