来自 Firefox 的 jQuery 1.10.2 警告问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19372658/
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
jQuery 1.10.2 warning issue from Firefox
提问by user1995781
I tried to use latest jQuery for my website and I get this warning sign and message from Firefox 24.
我试图在我的网站上使用最新的 jQuery,但我从 Firefox 24 收到了这个警告标志和消息。
Warning: Use of
getPreventDefault()
is deprecated. UsedefaultPrevented
instead.Source File: file:///C:/wamp/www/bootstrap3/dist/js/jquery-1.10.2.min.js
Line: 5
Warning: SyntaxError: Using
//@
to indicate source map URL pragmas is deprecated. Use//#
insteadSource File: file:///C:/wamp/www/bootstrap3/dist/js/jquery-1.10.2.min.js
Line: 1
警告:
getPreventDefault()
不推荐使用。使用defaultPrevented
来代替。源文件:file:///C:/wamp/www/bootstrap3/dist/js/jquery-1.10.2.min.js
线路:5
警告:
//@
语法错误:不推荐使用用于指示源映射 URL 编译指示。使用//#
替代源文件:file:///C:/wamp/www/bootstrap3/dist/js/jquery-1.10.2.min.js
线路:1
Is it fine to leave that problem? How to solve it?
留下那个问题可以吗?如何解决?
回答by hexacyanide
This is a known issue, reported for version 1.10.2 and has been resolved for the 1.11/2.1 jQuery milestone. See a proposed pull request here, and the report on the bug tracker here.
这是一个已知问题,已在 1.10.2 版中报告,并已在 1.11/2.1 jQuery 里程碑中得到解决。了解建议的拉动请求在这里,并在bug跟踪系统,报告在这里。
To fix this, just use a later version of jQuery, or change this line in event.js
from:
要解决此问题,只需使用更高版本的 jQuery,或将这一行更改event.js
为:
this.isDefaultPrevented = ( src.defaultPrevented || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
To this line:
到这一行:
this.isDefaultPrevented = src.defaultPrevented ? returnTrue : returnFalse;
Edit:The pull request linked above was never merged, although it did fix the problem. The issue was instead resolved by thiscommit and looks like this:
编辑:上面链接的拉取请求从未合并,尽管它确实解决了问题。该问题已通过此提交解决,如下所示:
this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && ( src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
回答by user1995781
jQuery version 1.11.0 is out now. You may download it here: http://jquery.com/download/. It solves the warning issue on Firefox.
jQuery 1.11.0 版现已发布。你可以在这里下载:http: //jquery.com/download/。它解决了 Firefox 上的警告问题。
回答by Bikram Shrestha
it resolved by replacing the latest version of js , visit jquery site and replace with the latest jquery for the listed file
它通过替换最新版本的 js 来解决,访问 jquery 站点并替换为列出文件的最新 jquery
jquery-1.10.2.js
jquery-1.10.2.min.js
jquery-1.10.2.min.map