Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 976e67f

Browse files
authored
Merge pull request #76 from ostermanj/master
Adds noResults property to prevent onChange event from firing when k…
2 parents b995672 + e04c2b0 commit 976e67f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/selectr.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@
717717

718718
if (e.which === 13) {
719719

720-
if (this.config.taggable && this.input.value.length > 0) {
720+
if ( this.noResults || (this.config.taggable && this.input.value.length > 0) ) {
721721
return false;
722722
}
723723

@@ -1960,12 +1960,14 @@
19601960
// Append results
19611961
if ( !f.childElementCount ) {
19621962
if ( !this.config.taggable ) {
1963+
this.noResults = true;
19631964
this.setMessage( this.config.messages.noResults );
19641965
}
19651966
} else {
19661967
// Highlight top result (@binary-koan #26)
19671968
var prevEl = this.items[this.navIndex];
19681969
var firstEl = f.querySelector(".selectr-option:not(.excluded)");
1970+
this.noResults = false;
19691971

19701972
util.removeClass( prevEl, "active" );
19711973
this.navIndex = firstEl.idx;

0 commit comments

Comments
 (0)