Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for error "No input element found" (bug #463) #464

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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