MVC使用jQuery 1.9不工作不显眼的审定 [英] MVC unobtrusive validation with JQuery 1.9 not working

查看:159
本文介绍了MVC使用jQuery 1.9不工作不显眼的审定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了所有的步骤,在这个岗位描述:

I've done all the steps as described in this post:

<一个href=\"http://stackoverflow.com/questions/14391867/unobtrusive-ajax-stopped-working-after-update-jquery-to-1-9-0\">Unobtrusive阿贾克斯停止更新后的jQuery合作1.9.0

和这一个:

<一个href=\"http://stackoverflow.com/questions/14405178/jquery-unobtrusive-ajax-plugin-broken-when-updating-to-jquery-1-9-0\">jquery.unobtrusive-ajax插件更新到jQuery的时候破1.9.0

不过,我还是在这一行获得萤火警告(jquery.validate.unobtrusive.js)

However I still get a warning in firebug at this line in (jquery.validate.unobtrusive.js)

 $jQval.unobtrusive.parse(document);

推荐答案

您的解决方案是不是不正确的,你的修复做这项工作,但我认为它的一些背景资料不会受到伤害。

Your solution is not incorrect, and your fix does the job, but I think a little background information on it would not hurt.

请注意,是什么原因导致该警告是迁移的jQuery插件

Note that what causes the warning is the jQuery Migrate plugin.

这是提供根据旧的jQuery的版本code向后兼容性。如果你不想被警告德precated特点以及如何将它们升级到当前的标准,则可以使用以下行code的禁止警告:

It is for providing backward compatibility for code depending on older jQuery versions. If you do not want to be warned about deprecated features and how to update them to the current standard, you can disable the warnings with the following line of code:

jQuery.migrateMute = true;

请注意,这些警告仅使用jQuery迁移的开发版本发生,因此,如果您切换到jQuery的迁移(的缩小的版本 jQuery的-迁移-1.0.0.min.js )这条线​​甚至不是必需的。

Note that these warnings only happen with the development version of jQuery Migrate, so if you switch to the minified version of jquery migrate (jquery-migrate-1.0.0.min.js) this line is not even required.

另外请注意,您在使用jQuery文件的开发版本,在生产环境中,你应该使用缩小的版本,让你的修复将需要在 jquery.validate.unobtrusive来还实施。 min.js

Also note that you are using the development versions of the jquery files, in a production environment you should use the minified versions, so your fix would need to be also implemented in jquery.validate.unobtrusive.min.js.

所以,这一切的一切:


  • 您不需要解决它,如果你使用了jQuery插件迁移(你这样做)。

  • 这一警告可以被禁用。

  • 这一警告不会在生产环境中显示出来(如果使用正确的脚本)。

  • 微软将有望反正修好它jquery.validate.unobtrusive
  • 的下一个版本
  • 如果你解决它,请确保您还修复它在精缩版

  • 修正它会是你可以删除的jQuery插件迁移(如果你是绝对肯定是有根据传统的jQuery的功能在你的应用程序不需要JavaScript,我只推荐)的唯一好处。

  • You do not need to fix it, if you use the jQuery Migrate plugin (which you do).
  • That warning can be disabled.
  • That warning will not show up in a production environment (if the correct scripts are used).
  • Microsoft will hopefully fix it anyway in the next version of jquery.validate.unobtrusive
  • If you DO fix it, make sure you also fix it in the minified version.
  • The only benefit of fixing it will be that you can drop the jQuery Migrate plugin (which I only recommend if you are absolutely sure that there is no javascript in your app depending on legacy jQuery features).

这篇关于MVC使用jQuery 1.9不工作不显眼的审定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆