Skip to content

Commit 18d3e7e

Browse files
authored
Merge pull request KazanExpress#338 from yamagen0915/replace_with_for_statement
Replace Array.prototype.findIndex with a for statement (for IE11 compatibility)
2 parents 16291a4 + f973177 commit 18d3e7e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/vue-simple-suggest.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@ export default {
206206
return this.inputIsComponent ? '$off' : 'removeEventListener'
207207
},
208208
hoveredIndex () {
209-
return this.suggestions.findIndex(el => this.hovered && (this.valueProperty(this.hovered) == this.valueProperty(el)))
209+
for (let i = 0; i < this.suggestions.length; i++) {
210+
const el = this.suggestions[i];
211+
if (this.hovered && (this.valueProperty(this.hovered) == this.valueProperty(el))) {
212+
return i;
213+
}
214+
}
215+
return -1;
210216
},
211217
textLength () {
212218
return (this.text && this.text.length) || (this.inputElement.value.length) || 0

0 commit comments

Comments
 (0)