Skip to content

Commit aceb4b3

Browse files
committed
Avoid modifying query casing until substring comparison
1 parent 7aff5ad commit aceb4b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class FilterInputElement extends HTMLElement {
7171
async function filterResults(filterInput: FilterInputElement, checkCurrentQuery: boolean = false) {
7272
const input = filterInput.input
7373
if (!input) return
74-
const query = input.value.toLowerCase()
74+
const query = input.value.trim()
7575
const id = filterInput.getAttribute('aria-owns')
7676
if (!id) return
7777
const container = document.getElementById(id)
@@ -124,7 +124,7 @@ async function filterResults(filterInput: FilterInputElement, checkCurrentQuery:
124124
}
125125

126126
function matchSubstring(_item: HTMLElement, itemText: string, query: string): MatchResult {
127-
const match = itemText.indexOf(query) !== -1
127+
const match = itemText.toLowerCase().indexOf(query.toLowerCase()) !== -1
128128
return {
129129
match,
130130
hideNew: itemText === query
@@ -133,7 +133,7 @@ function matchSubstring(_item: HTMLElement, itemText: string, query: string): Ma
133133

134134
function getText(filterableItem: HTMLElement) {
135135
const target = filterableItem.querySelector('[data-filter-item-text]') || filterableItem
136-
return (target.textContent || '').trim().toLowerCase()
136+
return (target.textContent || '').trim()
137137
}
138138

139139
function updateNewItem(newItem: HTMLElement, query: string) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy