]> git.mdlowis.com Git - projs/mdl.git/commitdiff
pages.children is an HTMLCollection (does not have forEach or map)
author80B <wtf@idk.lol>
Thu, 7 Jan 2021 22:10:40 +0000 (22:10 +0000)
committer80B <wtf@idk.lol>
Thu, 7 Jan 2021 22:11:06 +0000 (22:11 +0000)
[...pages.children] converts it to an array (does have forEach and map)

index.html

index 88f0e9a2f3c09aa3bba53603258e5d53490e23dc..ff4bdc2c13940104e0b2ba224c547525243cdff6 100644 (file)
@@ -33,8 +33,7 @@ const loadPage = file => {
 
     const filterPages = (allitems) => {
         const value = search.value.toLowerCase();
-        for (var i = 0; i < pages.children.length; i++) {
-            const child = pages.children[i];
+        [...pages.children].forEach(child => {
             if (child.style.display !== "none" || allitems) {
                 if (!child.text) {
                     child.text = child.innerText.toLowerCase();