From 4c024e41cbf9194e7863179d5f459a3ea181dd4b Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 13 Feb 2025 16:16:02 +0000 Subject: [PATCH] Inspector: Do less work when filtering properties As soon as a row has a cell that matches, we can stop looking. If the search text is empty, we can skip matching altogether. --- Base/res/ladybird/inspector.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Base/res/ladybird/inspector.js b/Base/res/ladybird/inspector.js index c3d9917b49b..eb002bb5d2f 100644 --- a/Base/res/ladybird/inspector.js +++ b/Base/res/ladybird/inspector.js @@ -337,9 +337,18 @@ inspector.setStyleSheetSource = (identifier, sourceBase64) => { }; const applyPropertyFilter = (row, searchText) => { - const nameMatch = row.cells[0].textContent.toLowerCase().includes(searchText); - const valueMatch = row.cells[1].textContent.toLowerCase().includes(searchText); - let matches = nameMatch || valueMatch; + let matches = false; + if (searchText) { + for (let cell of row.cells) { + if (cell.textContent.toLowerCase().includes(searchText)) { + matches = true; + break; + } + } + } else { + // Empty searchText matches everything, so skip the checks. + matches = true; + } if (matches) { row.classList.remove("hidden-row");