Skip to content

Commit

Permalink
fix: wrap querySelectorAll in Array.from (closes #1313)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres authored and Marcos Cáceres committed Jul 10, 2017
1 parent bd68adf commit dfc3d52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/core/id-headers.js
Expand Up @@ -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();
}
6 changes: 4 additions & 2 deletions src/core/utils.js
Expand Up @@ -191,7 +191,7 @@ export function createResourceHint(opts) {
}

export function normalizePadding(text = "") {
if(!text){
if (!text) {
return "";
}
if (typeof text !== "string") {
Expand Down Expand Up @@ -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();
});
}
Expand Down

0 comments on commit dfc3d52

Please sign in to comment.