jQuery通过与IE7/IE8兼容的方式在IE10上进行必需的验证来验证错误

问题描述:

有一个

there is a Confirmed bug in IE10 compatibility mode that won't be fixed for IE10:

在IE10中与IE8兼容
$ element.get(0).getAttribute("required")在缺少必需属性时返回",这将导致需要所有字段

In IE10 in compatibility to IE8
$element.get(0).getAttribute("required") returns "" when the required attribute is missing, this causes ALL fields to be required

在IE10中与IE7兼容
$ element.get(0).getAttribute("required")在所有情况下均返回null.
因此您不能将required用作元素

In IE10 in compatibility to IE7
$element.get(0).getAttribute("required") returns null in all cases.
so you can't use required as an attribute on the element

插件作者不打算处理兼容性视图,因为用户不应该遇到兼容性视图,但是只想检查旧IE中某些内容的开发人员可能想要

The plugin Author doesn't plan to handle compatibility views as users shouldn't encounter it, but developers that just want to check something in old IE might want to

在IE10中与IE8兼容
如果缺少必需的属性,则element.attributes ["required"]为空

In IE10 in compatibility to IE8
element.attributes["required"] is null if the required attribute is missing

在IE10中与IE7兼容
如果存在必需属性,则element.attributes ["required"].value返回"-1",否则返回"null"

In IE10 in compatibility to IE7
element.attributes["required"].value returns "-1" if required attribute exists and "null" otherwise

因此将我的叉子更新为jQuery validate插件以进行此修复 这里的所有细节 https://github.com/avipinto/jquery-validation/commit/a22d4c37c3047199bf17a4943e3be352d

so updated my fork to the jQuery validate plugin for this fix all details here https://github.com/avipinto/jquery-validation/commit/a22d4c37c3047199bf17a4943e3be352d88d8158