Skip to content

Commit 19ab36b

Browse files
committed
Update previous value deletion if multiple name attributes are set
1 parent 372e832 commit 19ab36b

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,8 @@
10621062
}
10631063
}
10641064

1065-
if (nameAttrs.indexOf(k) !== -1 && testResults.indexOf(true) !== -1) {
1065+
// First handle name search, then standard filtering.
1066+
if (typeof nameAttrs !== 'undefined' && nameAttrs.indexOf(k) !== -1 && testResults.indexOf(true) !== -1) {
10661067
return true;
10671068
} else {
10681069
if (testResults.indexOf(true) === -1) {
@@ -2895,10 +2896,17 @@
28952896
// Check for a previous value.
28962897
if (
28972898
typeof searchInput !== 'undefined' &&
2898-
'' === searchInput &&
2899-
filters.hasOwnProperty(_this.settings.nameAttribute)
2899+
'' === searchInput
29002900
) {
2901-
delete filters[_this.settings.nameAttribute];
2901+
if (typeof nameAttrs !== 'undefined') {
2902+
for (var pa = 0; pa < nameAttrs.length; pa++) {
2903+
if (nameAttrs[pa] in filters) {
2904+
delete filters[nameAttrs[pa]];
2905+
}
2906+
}
2907+
} else {
2908+
delete filters[_this.settings.nameAttribute];
2909+
}
29022910
}
29032911
}
29042912

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/jquery.storelocator.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,10 +2892,17 @@
28922892
// Check for a previous value.
28932893
if (
28942894
typeof searchInput !== 'undefined' &&
2895-
'' === searchInput &&
2896-
filters.hasOwnProperty(_this.settings.nameAttribute)
2895+
'' === searchInput
28972896
) {
2898-
delete filters[_this.settings.nameAttribute];
2897+
if (typeof nameAttrs !== 'undefined') {
2898+
for (var pa = 0; pa < nameAttrs.length; pa++) {
2899+
if (nameAttrs[pa] in filters) {
2900+
delete filters[nameAttrs[pa]];
2901+
}
2902+
}
2903+
} else {
2904+
delete filters[_this.settings.nameAttribute];
2905+
}
28992906
}
29002907
}
29012908

0 commit comments

Comments
 (0)