问题描述
我尝试在另一个模态中包含一个模态.但是,我在 firefox 中遇到了类似 too much recursion
的错误.
I try to have a modal inside another modal. However, I got an error like too much recursion
in firefox.
我使用了最新的 jQuery 和 Twitter 引导程序,但仍然有这个问题.
I used the latest jQuery and Twitter bootstrap but still have this problem.
这是显示错误的plunker
您可以在控制台中找到错误Uncaught RangeError: Maximum call stack size exceeded
或 太多递归
You can find errors in console Uncaught RangeError: Maximum call stack size exceeded
or too much recursion
有人知道怎么解决吗?谢谢
Does anyone know how to fix it? Thanks
推荐答案
好的,好像已经发现了一个问题.
Ok, it seems like an issue that has been discovered.
(显然我应该使用关键字Uncaught RangeError: Maximum call stack size exceeded"而不是递归过多":( )
(apparently I should use key word "Uncaught RangeError: Maximum call stack size exceeded" instead of "too much recursion" :( )
以下是解决方案.
1.修改modal.js
在这篇文章中,https://github.com/twbs/bootstrap/pull/5022
@onassar 提出解决方案
@onassar bring up a solution
跟进:对于使用 bootstrap-modal v2.2.0 的任何人,在executeFocus 方法,注释掉 that.$element.focus() 似乎解决了问题.
这样做的结果是模态没有得到关注(pfft,我可以自己做:P),因此,多种模态不会挑战一个另一个焦点(这导致了一个无限循环,一个范围错误/递归循环).
The result of this is the modal's don't get focused upon (pfft, I can do that myself :P), and thus, the multiple modals don't challenge one-another for focus (which resulted in an infinite loop, and a rangerror/recursive loop).
希望有帮助:)
我试过了,效果很好.(plunker)
I tried and it works. (plunker)
看起来效果还不错.
3.等待官方解决.
在他们的路线图中,他们确实想在某个时候重写这个模态插件.
In their roadmap, they do want to rewrite this modal plugin at some point.
这篇关于为什么使用 twitter bootstrap 的多模态错误太多递归?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!