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:
parent
37ca2fc25c
commit
4c024e41cb
Notes:
github-actions[bot]
2025-02-17 11:56:41 +00:00
Author: https://github.com/AtkinsSJ
Commit: 4c024e41cb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3561
Reviewed-by: https://github.com/gmta ✅
1 changed files with 12 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue