本文翻译自:WebKit issues with event.layerX and event.layerY

I just noticed that I get tons of deprecated warnings in the latest (canary) build of Chrome. 我刚刚注意到,在最新版(金丝雀)的Chrome浏览器中,我收到了很多不推荐使用的警告。

event.layerX and event.layerY are broken and deprecated in WebKit. WebKit中的event.layerX和event.layerY已损坏和弃用。 They will be removed from the engine in the near future. 它们将在不久的将来从引擎中删除。

Looks like jQuery is screwing thing up. 看起来jQuery搞砸了。

I'm using: jquery-1.6.1.min.js . 我正在使用: jquery-1.6.1.min.js

Would it help to upgrade to the latest jQuery version or isn't it fixed yet or is it a Chrome bug or is it something else. 它是否有助于升级到最新的jQuery版本,或者它是否已修复,或者是Chrome错误还是其他?

PS 聚苯乙烯

I cannot show you code because I think it's a general error, but I suspect the warnings get thrown when I try to access a jQuery object or when jQuery tries to access the layerX / layerY (well I'm pretty sure that's the case considering the error :P). 我无法向您显示代码,因为我认为这是一个普遍错误,但是我怀疑当我尝试访问jQuery对象或jQuery尝试访问layerX / layerY时会抛出警告(嗯,我很确定这是考虑到错误:P)。

jQuery probably copies those properties into the jQuery object. jQuery可能会将这些属性复制到jQuery对象中。

So... 所以...

What's going on? 这是怎么回事?

EDIT 编辑

jQuery 1.7 is out and fixes this issue. jQuery 1.7已经发布并解决了此问题。

Read more at their blog, here . 在这里,在他们的博客上内容。


#1楼

参考:https://stackoom.com/question/Wpku/WebKit与event-layerX和event-layerY有关的问题


#2楼

I ran into this issue in my own code. 我在自己的代码中遇到了这个问题。 It turns out I was iterating over all properties on an event object as part of a debugging/inspection tool that I was using. 事实证明,我正在迭代事件对象的所有属性,这是我使用的调试/检查工具的一部分。 In this particular instance I was using jQuery's $.extend to clone the object for later inspection, but I believe any of the standard iteration techniques in the various toolkits would have triggered the warning as well. 在此特定实例中,我使用jQuery的$ .extend克隆对象以供以后检查,但我相信各种工具包中的任何标准迭代技术也会触发该警告。

I mention it here because my initial thought of simply searching the code base for instances of layerX or layerY didn't help - the property was being referenced generically, not by name. 我在这里提到它是因为我最初的想法只是简单地在代码库中搜索layerX或layerY实例并没有帮助-该属性是通用引用的,而不是名称。


#3楼

What's going on!? 这是怎么回事!?

"jQuery probably copies those properties into the jQuery object." “ jQuery可能会将这些属性复制到jQuery对象中。” You're exactly correct, so it sounds like you already know! 您完全正确,因此听起来您已经知道了! :) :)

Hopefully jQuery will update their code to stop touching that, but at the same time WebKit should have known better than to log a deprecation warning on an event (at least in my opinion). 希望jQuery将更新其代码以停止修改,但与此同时WebKit应该比在事件中记录弃用警告更好(至少在我看来)。 One mousemove handler and your console explodes. 一个mousemove处理程序和您的控制台爆炸。 :) :)

Here's a recent jQuery ticket: http://bugs.jquery.com/ticket/10531 这是最近的jQuery票证: http : //bugs.jquery.com/ticket/10531

UPDATE: This is fixed now if you upgrade to jQuery 1.7. 更新:如果您升级到jQuery 1.7,现在已修复。

Please note that if upgrading jQuery doesn't fix the issue for you it may have something to do with used extensions / plugins as Jake stated in his answer . 请注意,如果升级jQuery不能为您解决问题,则可能与使用的扩展名/插件有关,如Jake在其回答中所述 。


#4楼

http://jsperf.com/removing-event-props/2 http://jsperf.com/removing-event-props/2

The temporary fix is to run this code before you do any event binding via jQuery: 临时解决方法是在通过jQuery执行任何事件绑定之前运行以下代码:

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

UPDATE 更新

See the latest performance tests to find out what the fastest way is to remove the event props. 查看最新的性能测试以了解最快的方法是删除事件道具。


#5楼

The enormous amount of these messages (I just got 80000 of them while using gmail) is indeed a bug in Chrome. 这些消息的数量之多(使用gmail时我刚收到80000条消息确实是Chrome中的错误。

You should star the issue on Chromium . 您应该在Chromium上加注星号 。


#6楼

它也可能是由Chrome扩展引起的,因此,请检查它们是否jQuery更新不起作用。

WebKit与event.layerX和event.layerY有关的问题相关推荐

  1. 解决[event.layerX and event.layerY are broken and deprecated in WebKit]

    今天拿出以前做的一套UI做点小东西,运行没啥异常,但是JS控制台一直提示[event.layerX and event.layerY are broken and deprecated in WebK ...

  2. event 和 window.event

    event 和 window.event 出处:http://hi.baidu.com/zzcc_8/blog/item/1c6e7a8f560765f3503d9200.html < html ...

  3. Dojo学习笔记(8. dojo.event dojo.event.topic dojo.event.browser)

    Dojo学习笔记(8. dojo.event & dojo.event.topic & dojo.event.browser) 模块:dojo.event 终于进入有名的dojo事件处 ...

  4. if(window.event) e = window.event

    浏览器事件对象兼容 function func(e){ if(window.event){ e = window.event; } } 浏览器中的事件都是以对象的形式存在的,IE浏览器与标准DOM浏览 ...

  5. js中event,event.srcElement,event.target在IE和firefox下的兼容性

    1.window.event对象 IE:有window.event对象 firefox:没有window.event对象.可以通过函数的参数传递event对象.例 如:οnmοusedοwn=func ...

  6. event.stopPropagation和event.preventDefault有什么区别?

    他们似乎在做同样的事情--是现代的还是老的? 还是不同的浏览器支持它们? 当我自己处理事件(没有框架)时,我总是检查两者并执行(如果存在). (我也return false ,但是我感觉不适用于与no ...

  7. java event sourcing_深入浅出Event Sourcing和CQRS

    原标题:深入浅出Event Sourcing和CQRS Event Sourcing也叫事件溯源,是这些年另一个越来越流行的概念,是大神Martin Fowler提出的一种架构模式.简单来说,它有几个 ...

  8. 阻止事件冒泡,阻止默认事件,event.stopPropagation()和event.preventDefault(),return false的区别

    今天来看看前端的冒泡和事件默认事件如何处理 1.event.stopPropagation()方法 这是阻止事件的冒泡方法,不让事件向documen上蔓延,但是默认事件任然会执行,当你掉用这个方法的时 ...

  9. function(event)中的event详解

    目录: 一.function(event)中的event是什么? 二.为什么要加上function(event)中的event? 三.如果需要引入别的参数,那要怎么获取function(event)中 ...

最新文章

  1. c# out ref
  2. linux下svn客户端安装及环境配置
  3. C++函数返回多个变量
  4. 和低压电气有关的71个问题
  5. sourceTree安装与使用
  6. mysql atlas更新问题_Atlas几种常见故障解决(不定期更新)
  7. 【快讯】阿里云张建锋:数据成为经济发展的新生产要素
  8. python3.6网络爬虫_python3.6网络爬虫
  9. 洛谷P2888 [USACO07NOV]牛栏Cow Hurdles
  10. JavaScript巧学巧用
  11. 类模版的static成员
  12. 洛谷P4867 Gty的二逼妹子序列(莫队+树状数组)
  13. MM32F031 M0内核 IAP
  14. 校园二手平台使用说明
  15. 关爱中老年健康,践行康养华夏,中老年春晚《康养华夏》栏目启动大会在广州盛大举行
  16. DataGridView控件数据导出表格
  17. 【华为OD机试真题2023 JAVA】不含101的数
  18. linux arm 无法执行二进制文件,qemu-arm无法运行arm编译的二进制文件
  19. 前端关于获取网络时间的方法 api (直接获取时间戳)
  20. Fiddler修改请求、响应数据

热门文章

  1. Spring 注解的作用
  2. 【程序员跳槽】学弟被高薪挖走不到一年就后悔的无奈经历,到底是老板的水深?还是学弟太年轻?
  3. Android启动失败
  4. 【Linux】【C/C++】十叉非完全树的构造和重构
  5. 出一个简单的Spring框架入门教程
  6. 第四周项目五-用递归方法求解(输出Fibnacci序列的第20个数)
  7. Java创建线程的3种方式
  8. Android Framework学习总结
  9. (013)java后台开发之Mac系统安装和配置tomcat步骤详解
  10. vue-router 的重定向-redirect