-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Multiple init() calls are initiated by MutationObserver callback #149
Comments
Hello @stopdesign, The input field observer is already set to fire the I've tried reproducing the reported behavior on the same mentioned browsers, versions, and operating system but unfortunately couldn't get the same results as yours. My initial assumption is that you might be using a class for the input selector or the same id maybe. Please try to share any more details that might help in debugging that weird behavior. I'm thinking about availing an API for the Have a nice day, cheers! :) |
@TarekRaafat i have the same problem (i opened the issue for the feature request #89) Every event is triggered multiple time (include init), in my case 35 Sorry for the quality of code but i wrote it in hurry for the issue 😄 For the sake of completeness i use bootstrap and mdbootstrap but i don't think it's related and i found this in th Event Listeners tab on Chrome |
Hello @stopdesign and @cedbesafilm, Thanks for your patience. I have added a new API in v8.1 that controls the Hope this is convenient for you for the time being until I fix this issue, awaiting your feedback. Have a nice day, cheers! :) |
With default settings now the problem it's solved for me 😄 |
@cedbesafilm that's great! I'm glad to hear that your problem is solved. Please let me know if you need any further support. Have a nice day, cheers! :) |
In preInit you set the MutationObserver callback. It calls init() multiple times because mutationsList could have many MutationRecords. Some (all) of them could have inputField inside. For example, in my case I have 3 records:
https://tarekraafat.github.io/autoComplete.js/demo/ is affected. I see 9 init() calls.
Affected versions: >= 8.0.0.
OSX, Chrome 87.0.4280.67, Safari Version 13.0.4.
To Reproduce: visit the demo, open debug console, type any character and look at number of generic.json requests you have. I have 9 for each keypress event.
Expected behavior:
The text was updated successfully, but these errors were encountered: