Skip to content

Commit dd34cc5

Browse files
committed
always show spinner during searching. fixes select2#950 fixes select2#943
1 parent fcce8aa commit dd34cc5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

select2.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,8 +1356,6 @@ the specific language governing permissions and limitations under the Apache Lic
13561356
return;
13571357
}
13581358

1359-
search.addClass("select2-active");
1360-
13611359
function postRender() {
13621360
results.scrollTop(0);
13631361
search.removeClass("select2-active");
@@ -1386,9 +1384,6 @@ the specific language governing permissions and limitations under the Apache Lic
13861384
}
13871385
return;
13881386
}
1389-
else if (opts.formatSearching() && initial===true) {
1390-
render("<li class='select2-searching'>" + opts.formatSearching() + "</li>");
1391-
}
13921387

13931388
if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
13941389
if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
@@ -1399,6 +1394,12 @@ the specific language governing permissions and limitations under the Apache Lic
13991394
return;
14001395
}
14011396

1397+
if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
1398+
render("<li class='select2-searching'>" + opts.formatSearching() + "</li>");
1399+
}
1400+
1401+
search.addClass("select2-active");
1402+
14021403
// give the tokenizer a chance to pre-process the input
14031404
input = this.tokenize();
14041405
if (input != undefined && input != null) {

0 commit comments

Comments
 (0)