From dfc3d526da3e30fec63b289632fc4c3f930529b8 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 10 Jul 2017 19:57:46 +1000 Subject: [PATCH] fix: wrap querySelectorAll in Array.from (closes #1313) --- src/core/id-headers.js | 12 +++++++----- src/core/utils.js | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/core/id-headers.js b/src/core/id-headers.js index cd549829c8..bba3227de3 100644 --- a/src/core/id-headers.js +++ b/src/core/id-headers.js @@ -5,10 +5,12 @@ export const name = "core/id-headers"; export function run(conf, doc, cb) { - document - .querySelectorAll("h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])") - .forEach(elem => { - $(elem).makeID(); - }); + Array.from( + document.querySelectorAll( + "h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])" + ) + ).forEach(elem => { + $(elem).makeID(); + }); cb(); } diff --git a/src/core/utils.js b/src/core/utils.js index 2651194141..007d03bc9c 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -191,7 +191,7 @@ export function createResourceHint(opts) { } export function normalizePadding(text = "") { - if(!text){ + if (!text) { return ""; } if (typeof text !== "string") { @@ -288,7 +288,9 @@ export function normalizePadding(text = "") { // RESPEC STUFF export function removeReSpec(doc) { - doc.querySelectorAll(".remove, script[data-requiremodule]").forEach(elem => { + Array.from( + doc.querySelectorAll(".remove, script[data-requiremodule]") + ).forEach(elem => { elem.remove(); }); }