Skip to content

Commit

Permalink
Merge pull request #464 from tbl0605/bug-463
Browse files Browse the repository at this point in the history
Fix for error "No input element found" (bug #463)
  • Loading branch information
kaskar2008 committed Jun 30, 2021
2 parents c46db23 + 4c3a7e2 commit f0a7744
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 38 deletions.
24 changes: 13 additions & 11 deletions dist/cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ function _await(value, then, direct) {
return result.then(then);
}return then(result);
}function _invokeIgnored(body) {
var result = body();
if (result && result.then) {
var result = body();if (result && result.then) {
return result.then(_empty);
}
}function _catch(body, recover) {
Expand All @@ -75,7 +74,6 @@ function _await(value, then, direct) {
return result.then(void 0, recover);
}return result;
}function _finally(body, finalizer) {

try {
var result = body();
} catch (e) {
Expand Down Expand Up @@ -280,14 +278,16 @@ function _await(value, then, direct) {

return _await(_this3.$slots.default, function () {

_this3.inputElement = _this3.$refs['inputSlot'].querySelector('input');
_this3.$nextTick(function () {
_this3.inputElement = _this3.$refs['inputSlot'].querySelector('input');

if (_this3.inputElement) {
_this3.setInputAriaAttributes();
_this3.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
if (_this3.inputElement) {
_this3.setInputAriaAttributes();
_this3.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
});
});
} catch (e) {
return Promise.reject(e);
Expand Down Expand Up @@ -595,7 +595,9 @@ function _await(value, then, direct) {
if (this.text.length < this.minLength) {
this.hideList();
return;
}if (this.debounce) {
}

if (this.debounce) {
clearTimeout(this.timeoutInstance);
this.timeoutInstance = setTimeout(this.research, this.debounce);
} else {
Expand Down
24 changes: 13 additions & 11 deletions dist/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ function _await(value, then, direct) {
return result.then(then);
}return then(result);
}function _invokeIgnored(body) {
var result = body();
if (result && result.then) {
var result = body();if (result && result.then) {
return result.then(_empty);
}
}function _catch(body, recover) {
Expand All @@ -69,7 +68,6 @@ function _await(value, then, direct) {
return result.then(void 0, recover);
}return result;
}function _finally(body, finalizer) {

try {
var result = body();
} catch (e) {
Expand Down Expand Up @@ -260,14 +258,16 @@ function _await(value, then, direct) {

return _await(_this.$slots.default, function () {

_this.inputElement = _this.$refs['inputSlot'].querySelector('input');
_this.$nextTick(() => {
_this.inputElement = _this.$refs['inputSlot'].querySelector('input');

if (_this.inputElement) {
_this.setInputAriaAttributes();
_this.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
if (_this.inputElement) {
_this.setInputAriaAttributes();
_this.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
});
});
}),

Expand Down Expand Up @@ -564,7 +564,9 @@ function _await(value, then, direct) {
if (this.text.length < this.minLength) {
this.hideList();
return;
}if (this.debounce) {
}

if (this.debounce) {
clearTimeout(this.timeoutInstance);
this.timeoutInstance = setTimeout(this.research, this.debounce);
} else {
Expand Down
16 changes: 9 additions & 7 deletions dist/es7.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,16 @@ var VueSimpleSuggest = {
async mounted() {
await this.$slots.default;

this.inputElement = this.$refs['inputSlot'].querySelector('input');
this.$nextTick(() => {
this.inputElement = this.$refs['inputSlot'].querySelector('input');

if (this.inputElement) {
this.setInputAriaAttributes();
this.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
if (this.inputElement) {
this.setInputAriaAttributes();
this.prepareEventHandlers(true);
} else {
console.error('No input element found');
}
});
},
beforeDestroy() {
this.prepareEventHandlers(false);
Expand Down
2 changes: 1 addition & 1 deletion dist/iife.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/umd.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions lib/vue-simple-suggest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,16 @@ export default {
async mounted () {
await this.$slots.default;
this.inputElement = this.$refs['inputSlot'].querySelector('input')
this.$nextTick(() => {
this.inputElement = this.$refs['inputSlot'].querySelector('input')
if (this.inputElement) {
this.setInputAriaAttributes()
this.prepareEventHandlers(true)
} else {
console.error('No input element found')
}
if (this.inputElement) {
this.setInputAriaAttributes()
this.prepareEventHandlers(true)
} else {
console.error('No input element found')
}
})
},
beforeDestroy () {
this.prepareEventHandlers(false)
Expand Down

0 comments on commit f0a7744

Please sign in to comment.