Improve error handling to help prevent runtime errors

Adds input validation and safe property access to utility functions
to handle edge cases and invalid arguments gracefully
This commit is contained in:
Eddy G
2025-07-07 12:26:59 -04:00
parent a3c581aa93
commit 9c5ed0dcca
3 changed files with 18 additions and 4 deletions

View File

@@ -297,7 +297,7 @@ class AutoComplete {
// if a click is detected on the page, generally we hide the suggestions, unless the click was within the autocomplete elements
checkOutsideClick(e) {
if (e.target.id === 'txtLocation') return;
if (e.target?.parentNode?.classList.contains(this.options.containerClass)) return;
if (e.target?.parentNode?.classList?.contains(this.options.containerClass)) return;
this.hideSuggestions();
}
}