jQuery 'event.layerX 和 event.layerY 在 WebKit 中被破坏和弃用。错误

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

'event.layerX and event.layerY are broken and deprecated in WebKit.' Errors

jquerygoogle-chrome

提问by Greg

I just updated Chrome to version 16.0.912.63 and now I get hundreds of errors using jQuery 1.7.1. Seems to fire whenever the mouse is moved...

我刚刚将 Chrome 更新到 16.0.912.63 版,现在我在使用 jQuery 1.7.1 时遇到了数百个错误。每当鼠标移动时似乎都会触发...

event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.

Should I be worried about this? Is anyone else getting these errors?

我应该担心这个吗?还有其他人收到这些错误吗?

My useragent:

我的用户代理:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7

UPDATE:In my case it was the Chrome extension "Search by Image (by Google) 1.1.0". I just had to disable it, it had nothing to do with my application.

更新:就我而言,它是 Chrome 扩展程序“按图像搜索(由 Google)1.1.0”。我只需要禁用它,它与我的应用程序无关。

采纳答案by Greg

In my case it was the Chrome extension "Search by Image (by Google) 1.1.0"

就我而言,它是 Chrome 扩展程序“按图像搜索(由 Google)1.1.0”

Nothing to do with my application.

与我的申请无关。

Disable it and you'll be free of these annoying errors.

禁用它,您将摆脱这些烦人的错误。

回答by devnull69

You should only worry about this if it is:

如果是这样,你应该只担心这个:

  • your website and
  • you are planning to upgrade jQuery to a version > 1.7 in the future and
  • you are using layerXand layerYall over the place
  • 您的网站和
  • 你打算在未来将 jQuery 升级到一个 > 1.7 的版本,并且
  • 你正在使用layerXlayerY到处都是

The message is just telling you that those two properties are deprecated (at least in Webkit) and will be removed from jQuery in the near future.

该消息只是告诉您这两个属性已被弃用(至少在 Webkit 中)并且将在不久的将来从 jQuery 中删除。

回答by mdowen

add js to js file footer:

将 js 添加到 js 文件页脚:

(function(){
    //remove layerX and layerY
    var all = $.event.props,
    len = all.length,
    res = [];
    while (len--) {
      var el = all[len];
      if (el != 'layerX' && el != 'layerY') res.push(el);
    }
    $.event.props = res;
}());

you can try it.

你可以试试看。