]> git.mdlowis.com Git - projs/mdl.git/commitdiff
remove child.text and prefer includes over indexOf
author80B <wtf@idk.lol>
Thu, 7 Jan 2021 22:15:57 +0000 (22:15 +0000)
committer80B <wtf@idk.lol>
Thu, 7 Jan 2021 22:15:57 +0000 (22:15 +0000)
index.html

index ff4bdc2c13940104e0b2ba224c547525243cdff6..30cdd183f16c2476da15bbf465adc8e45d46450f 100644 (file)
@@ -35,10 +35,7 @@ const loadPage = file => {
         const value = search.value.toLowerCase();
         [...pages.children].forEach(child => {
             if (child.style.display !== "none" || allitems) {
-                if (!child.text) {
-                    child.text = child.innerText.toLowerCase();
-                }
-                const titleMatch = (child.text.toLowerCase().indexOf( value ) !== -1);
+                const titleMatch = child.innerText.toLowerCase().includes(value);
                 child.style.display = ((titleMatch) ? "list-item" : "none");
             }
         }