Ker*_*rry 6 html forms validation jquery internet-explorer-10
我有一个表格(以最简单的形式)如下所示:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>PC Trade Up - Test </title>
</head>
<body id="tech">
<div id="page">
<section id="main">
<h2>
Test
</h2>
<form action="/tech/migration/test" method="post">
<input id="test1" name="test1" type="text" value="" />
<div>
<button type="Submit" id="formSubmit" class="btn">
Submit
</button>
<button type="Reset" id="formReset" class="btn">
Reset
</button>
</div>
</form>
</section>
</div>
<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/content/js/lib/jquery.form.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我可以使用此表单并提交,没有任何问题.当我按下Reset按钮但是我在IE10控制台中收到"SCRIPT28:堆栈空间不足".奇怪的是,我无法在Firefox中重现这一点.
我通过删除jquery.form.js引用避免了这个问题,但这包含在我的包中.错误似乎从jquery.validation.js冒出来.我已将此跟踪到此脚本的第417行,其内容如下:
resetForm: function () {
if ($.fn.resetForm) {
$(this.currentForm).resetForm();
}
this.submitted = {};
this.lastElement = null;
this.prepareForm();
this.hideErrors();
this.elements().removeClass(this.settings.errorClass).removeData("previousValue");
},
Run Code Online (Sandbox Code Playgroud)
这条线
$(this.currentForm).resetForm();
Run Code Online (Sandbox Code Playgroud)
似乎在产生这个错误之前递归调用254次迭代,(有意义).但我无法确定递归的来源.我知道在后代上触发一个事件会冒泡并导致这种循环,但是我不知道我在做什么,也没有在这个脚本中看到这个.
有关确定递归或循环源的建议吗?
我遇到了同样的问题,我可以通过注释掉上述函数来解决它:
resetForm: function() {
if ( $.fn.resetForm ) {
//$(this.currentForm).resetForm();
}
this.submitted = {};
this.lastElement = null;
this.prepareForm();
this.hideErrors();
this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
},
Run Code Online (Sandbox Code Playgroud)
我知道应该有一些正确的实现,但这个补丁到目前为止解决了问题,我也在 FF 和 Chrome 中尝试过,它似乎工作正常。
| 归档时间: |
|
| 查看次数: |
2267 次 |
| 最近记录: |