简体   繁体   English

错误:“递归过多”

[英]Error: “Too much recursion”

Firebug shows me the following error: too much recursion , I tried a lot to determine what causes me this error, but in vain Firebug向我显示以下错误: too much recursion ,我做了很多尝试以确定是什么导致了此错误,但徒劳无功

This is my JavaScript code: 这是我的JavaScript代码:

$(".scan").click(function(e){
    e.preventDefault();
    var docName = $("#nomPJ").val();
    $(this).attr("nomDoc",docName);
});

Another on a separated js file: 另一个在单独的js文件上:

$(".scan").live("click",function(event){
    alert("frame");
    var e = event.target;
    nomDoc = $(e).attr("nomDoc");
    idDoc = $(e).attr("idDoc");
    alert("id"+idDoc);
    $("#title").text(nomDoc);
    $("#modal-body").empty().append('<iframe frameBorder="0"  height="90%" width="98%" style="margin-left: 5px"  src="/GRH/Scan.jsp?nomDoc=' + nomDoc + '&idDoc='+idDoc+'"></iframe>');
    $("#myModal").modal({ dynamic: true });
});

The html element: html元素:

<a href="" class="scan" idDoc="1" nomDoc="" target="_blanck">numériser</a>

I removed to first code, but the problem still remains. 我删除了第一个代码,但问题仍然存在。

Ok, sound like a bug, but I have readed the docs and there is not dynamic option, anyway, is well know that the modal bootstrap plugin has some other bugs like the multiple modal bug . 好的,听起来像个bug,但是我已经阅读了文档,并且没有动态选项,无论如何,众所周知,模态引导插件还有其他一些bug,例如multimodal bug

Posible solutions: 可能的解决方案:

  1. Modify the modal.js which is not recommended 修改不推荐的modal.js
  2. Use another modal plugin . 使用另一个模式插件 It seems like it works pretty well. 看来效果很好。
  3. Merge the two click events into one 将两个点击事件合并为一个
  4. Delete the dynamic: true option on modal() function, set a fixed width to #myModal and overflow:scroll using css. 删除modal()函数上的dynamic: true选项,将固定宽度设置为#myModal然后使用CSS overflow:scroll

For those of you trying to actually troubleshoot this in some other application, firebug/fox is pretty rough; 对于那些试图在其他应用程序中进行实际故障排除的人来说,firebug / fox相当粗糙。 chrome will help you out a lot more. chrome将为您提供更多帮助。

If you're feeling your oats, or can't use chrome, this post saved me from a ton of hassle! 如果您感觉燕麦,或者不能使用铬, 这篇文章可以让我免去很多麻烦!

long story short, it goes through logging each function automatically, so 长话短说,它会自动记录每个功能,因此

function apples () {
  bananas()
}
function bananas () {
  apples()
}

becomes

function apples () {
  console.log('apples');
  bananas()
}
function bananas () {
  console.log('bananas');
  apples()
}

so that you can see exactly which functions are wrapped up in the all-to-vague "too much recursion" 这样一来,您就可以准确地看到哪些函数包含在模糊不清的“太多递归”中

happy troubleshooting! 排除故障!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM