Skip to content

Commit 6100770

Browse files
committed
Fixed empty name search value not clearing previous value
1 parent 1ea2277 commit 6100770

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v3.1.7 - 2022-05-23
1+
/*! jQuery Google Maps Store Locator - v3.1.7 - 2022-05-28
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2022 Bjorn Holine; Licensed MIT */
44

@@ -2836,6 +2836,15 @@
28362836
if (typeof searchInput !== 'undefined' && '' !== searchInput) {
28372837
filters[_this.settings.nameAttribute] = [searchInput];
28382838
}
2839+
2840+
// Check for a previous value.
2841+
if (
2842+
typeof searchInput !== 'undefined' &&
2843+
'' === searchInput &&
2844+
filters.hasOwnProperty(_this.settings.nameAttribute)
2845+
) {
2846+
delete filters[_this.settings.nameAttribute];
2847+
}
28392848
}
28402849

28412850
// Taxonomy filtering setup

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ filtering.
3737

3838
### Version 3.1.7
3939

40+
* Fixed empty name search value not clearing previous value.
4041
* Fixed openNearest setting not working in combination with querystringParams setting.
4142
* Fixed openNearest setting not opening correct location with custom sorting (sortBy) enabled.
4243

src/js/jquery.storelocator.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2832,6 +2832,15 @@
28322832
if (typeof searchInput !== 'undefined' && '' !== searchInput) {
28332833
filters[_this.settings.nameAttribute] = [searchInput];
28342834
}
2835+
2836+
// Check for a previous value.
2837+
if (
2838+
typeof searchInput !== 'undefined' &&
2839+
'' === searchInput &&
2840+
filters.hasOwnProperty(_this.settings.nameAttribute)
2841+
) {
2842+
delete filters[_this.settings.nameAttribute];
2843+
}
28352844
}
28362845

28372846
// Taxonomy filtering setup

0 commit comments

Comments
 (0)