javascript 更改类时超出最大调用堆栈大小 - Bootstrap、jQuery
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25265667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum call stack size exceeded when changing a class - Bootstrap, jQuery
提问by Adrian Todorov
I'm using jQuery 2.1.1, jQuery UI 1.11, Bootstrap 3.2, Fuel UX 2.3 (for the form wizard only) and BootstrapValidator v0.5.1-dev.
我正在使用 jQuery 2.1.1、jQuery UI 1.11、Bootstrap 3.2、Fuel UX 2.3(仅用于表单向导)和 BootstrapValidator v0.5.1-dev。
I have a huge bootstrapped form in a Fuel UX Wizard, with BootstrapValidator validation, along with a ton of jQuery for events and stuff(the total page is 1900 lines, that's why i haven't provided any code).
我在 Fuel UX 向导中有一个巨大的引导表单,带有 BootstrapValidator 验证,以及大量用于事件和内容的 jQuery(总页面为 1900 行,这就是我没有提供任何代码的原因)。
I had a div with class col-xs-8 around all of my form, everything was working fine. Then i changed it to class="container" (only change in the code, played it a couple of times back and forth), and now Chrome's console says :
我的所有表单都有一个带有 col-xs-8 类的 div,一切正常。然后我将其更改为 class="container"(仅更改代码,来回播放了几次),现在 Chrome 的控制台显示:
Uncaught RangeError: Maximum call stack size exceeded
Why?
为什么?
I have checked the call stack, there's nothing but jQuery functions there(so it shouldn't be something i or the BootstrapValidator has launched, should it?).
我检查了调用堆栈,那里只有 jQuery 函数(所以它不应该是我或 BootstrapValidator 已经启动的东西,是吗?)。
I have another page, with the same enviorenement, similar size and similar code - there the change from .col-xs-8 to .container went without issues.
我有另一个页面,具有相同的环境、相似的大小和相似的代码 - 从 .col-xs-8 到 .container 的更改没有问题。
Update: I discovered that if i leave the main div without a class, i also get the RangeError. Sooo here's my JS https://gist.github.com/sofixa/be2e575cf8a198c1cf89
更新:我发现如果我在没有类的情况下离开主 div,我也会得到 RangeError。Sooo 这是我的 JS https://gist.github.com/sofixa/be2e575cf8a198c1cf89
回答by Arkni
If your form is NOT structured by Bootstrap classes (the element containing field and associated label does NOT have form-group class), you will see the error :
如果您的表单不是由 Bootstrap 类构建的(包含字段和关联标签的元素没有表单组类),您将看到错误:
Uncaught RangeError: Maximum call stack size exceeded
Reference : Maximum call stack size exceeded error warningin the official docs.
参考:官方文档中的最大调用堆栈大小超出错误警告。