From: 80B Date: Thu, 7 Jan 2021 22:15:57 +0000 (+0000) Subject: remove child.text and prefer includes over indexOf X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=04907d7017c049899272c817fa9a1bf82d1125f4;p=projs%2Fmdl.git remove child.text and prefer includes over indexOf --- diff --git a/index.html b/index.html index ff4bdc2..30cdd18 100644 --- a/index.html +++ b/index.html @@ -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"); } }