mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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:
parent
37ca2fc25c
commit
4c024e41cb
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user