-
Notifications
You must be signed in to change notification settings - Fork 724
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
Maximum call stack size exceeded Error #542
Comments
Hi @bhumiradixweb! I am not able to duplicate the above conditions... it is very difficult to troubleshoot this issue without a demo. Please:
|
I am using following versions: jQuery: v2.1.3 I will try to duplicate the error on fiddle and let you know. Thanks |
Hello, This line But sometimes it goes into infinite loop. You can check sample demo here (https://jsfiddle.net/n6xeoLyp/25/)
This code added which generate error when you click on input field. Thanks |
Oh, that's the problem. Is there a specific reason why a "mousedown" needs to be triggered on the same element? That code is creating an infinite loop. I can fix this issue in the keyboard code, but it would still cause an error with other code (other than the keyboard) that binds to a "mousedown" event on the "body". |
Hello Mottie, I am not using mouse down event but making a call on the server to download the file which leads to infinite call because :
You have called function recurcisely which create infinite loop sometimes. For solution, i have changed close function call and working for me.
Thanks |
Ahhh, I forgot I did that in the autocomplete extension. |
Please let me know if the fix in the master branch resolves this issue. |
No, this changes not solved the issue. |
I only updated the |
I don't think the stack error has been fixed... I still see it in my local demo, but the keyboard plugin should no longer be the source of that error. |
Previously, you had to move the mouse over the virtual keys to cause an update. Mentioned in #542.
So, whatever changes i have applied is correct? |
No, what I'm saying is that the code to trigger a "mousedown" is causing the error. You can see it in this demo:
This is also not jQuery's fault, the code itself is causing the cyclical problem and needs to be modified; or a different method needs to be used: One alternative is to use an undocumented jQuery event property - $(document).on('mousedown', 'body', function(event) {
if (!event.isTrigger) {
console.log('triggering a mousedown!');
$('body').trigger('mousedown');
}
}); It only allows user "mousedown" clicks to pass through and trigger a "mousedown" on the body. |
This code I have written to prove that is creating issue otherwise in my code, I have not written cyclic code, it is creating issue just when i set cron and continuous make a call for files. |
Hehe sorry, I didn't mean to sound harsh. I know you only wrote that code as an example. Initially, I tried the modification you shared, but it didn't prevent the JS error... at least not the error with the cyclic code. Either way, that change would break the If this is still an issue, please provide an example closer to the situation you have to make it easier for me to troubleshoot. I'm not adept at server-side things (but I do know what a cron job is!), so I don't really know how to emulate the problem. |
Hello Mottie, I have set a cron job to download the file which contains keyboard code. So you can open a browser and in the background, you can run cronjob and don't refresh the page( you can write an ajax call for new content) and check the keyboard again after your file downloaded from somewhere. This is exact scenario but there might be 1% chance that you can duplicate error. If not, it is fine for now as I have changed the code in escClose() function :) Thanks |
Also getting below warning which slows down my system of hang system:
and if add this change cb9c5a4#diff-651b2c157b3bf6ac6630c0c6e0da9879 getting below error:
Kindly check the solution. This keyboard thing hangs my system totally. Thanks |
Hmm, I made the indicated change to prevent the stack size error you reported. Should I just restore the plugin to use the previous code? The error will again occur in the keyboard plugin, but then you won't get the performance issues... I'm sorry I don't have an ideal solution for you. Do you have any ideas on how to fix it? The proposed change to the I wonder, if setting a flag would work better? - demo using the previous version // flag to prevent trigger issues
var flag = false;
$(document).on('mousedown', 'body', function(event) {
if (!flag) {
flag = true;
$('body').trigger('mousedown');
setTimeout(function() {
flag = false;
}, 1);
}
});
$('#keyboard')
.keyboard({
autoAccept: true,
userClosed: true
})
.autocomplete({
source: availableTags
})
.addAutocomplete();
// change escClose function
var kb = $('#keyboard').getkeyboard(),
orig = kb.escClose;
kb.escClose = function(event) {
if (!flag) {
orig(event);
}
}; |
Hello @Mottie Here is the demo for generating error https://jsfiddle.net/n6xeoLyp/45/ can you please provide me solution? |
Hi again! Thanks for providing a demo of the problem!... it looks like it still involves the autocomplete plugin, so I'll try to spend some time on a solution for it soon. |
Any solution? Thanks |
Oh wow sorry! I've been super busy. I'll get this on my to-do list for today. |
This bug should finally be squashed! The error no longer occurs in this updated demo (using code from the master branch). I plan on releasing a new version within a week. |
Hello,
I am getting below error due to this line:
After few research I got that it is addAutocomplete error and due to this line:
if i comment the autocomplete code, no error occurring. Can you please advice me to fix the issue?
Thanks
The text was updated successfully, but these errors were encountered: