jquery.validate.js 中的错误“javaScript 运行时错误:无法获取未定义或空引用的属性‘调用’”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27965397/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:13:09  来源:igfitidea点击:

Error inside jquery.validate.js "javaScript runtime error: Unable to get property 'call' of undefined or null reference"

javascriptjqueryasp.netrazorjquery-validate

提问by john Gu

I am working on an asp.net mvc-5 web application. and i am using these scripts:-

我正在开发一个 asp.net mvc-5 Web 应用程序。我正在使用这些脚本:-

  • jquery 1.10.2
  • jquery-ui 1.8.24
  • jQuery Validation Plugin 1.11.1
  • jQuery 1.10.2
  • jquery-ui 1.8.24
  • jQuery 验证插件 1.11.1

Now when i run the application inside visual studio 2013, the following exception will happen on IE10 , while there will not be any problem on chrome or firefox :-

现在,当我在 Visual Studio 2013 中运行该应用程序时,IE10 上会发生以下异常,而 chrome 或 firefox 上不会出现任何问题:-

Unhandled exception at line 1234, column 5 in http://localhost:49392/Scripts/jquery.validate.js

0x800a138f - JavaScript runtime error: Unable to get property 'call' of undefined or null reference

the code which will raise the error inside the jquery.validate.js is :-

将在 jquery.validate.js 中引发错误的代码是:-

function($) {
    // only implement if not provided by jQuery core (since 1.4)
    // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
    if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
        $.each({
            focus: 'focusin',
            blur: 'focusout'
        }, function( original, fix ){
            $.event.special[fix] = {
                setup:function() {
                    this.addEventListener( original, handler, true );
                },
                teardown:function() {
                    this.removeEventListener( original, handler, true );
                },
                handler: function(e) {
                    var args = arguments;
                    args[0] = $.event.fix(e);
                    args[0].type = fix;
                    return $.event.handle.apply(this, args);
                }
            };
            function handler(e) {
                e = $.event.fix(e);
                e.type = fix;
                **return $.event.handle.call(this, e);**//this will raise the exception
            }
        });
    }

Can anyone adivce how i can solve this problem ? Thank

任何人都可以建议我如何解决这个问题?感谢

回答by Pandiyan Cool

installing jquery migrate may solve this PM> Install-Package jQuery.Migrate

安装 jquery migrate 可以解决这个问题 PM> Install-Package jQuery.Migrate