From 04907d7017c049899272c817fa9a1bf82d1125f4 Mon Sep 17 00:00:00 2001 From: 80B Date: Thu, 7 Jan 2021 22:15:57 +0000 Subject: [PATCH] remove child.text and prefer includes over indexOf --- index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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"); } } -- 2.52.0