1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

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.
This commit is contained in:
Sam Atkins 2025-02-13 16:16:02 +00:00 committed by Jelle Raaijmakers
parent 37ca2fc25c
commit 4c024e41cb
Notes: github-actions[bot] 2025-02-17 11:56:41 +00:00

View file

@ -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");