博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WebKit与event.layerX和event.layerY有关的问题
阅读量:2289 次
发布时间:2019-05-09

本文共 3527 字,大约阅读时间需要 11 分钟。

本文翻译自:

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 . 阅读更多内容。


#1楼

参考:


#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: 这是最近的jQuery票证: :

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 . 请注意,如果升级jQuery不能为您解决问题,则可能与使用的扩展名/插件有关,如Jake在其 。


#4楼

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

(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;}());

UPDATE 更新

See the 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 . 您应该星 。


#6楼

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

转载地址:http://ascnb.baihongyu.com/

你可能感兴趣的文章
18级大数据专家,跟大家漫谈大数据平台架构,你能学到多少?上篇
查看>>
18级大数据专家,漫谈大数据平台安全风险与建设,值得学(下篇)
查看>>
阿里P8终于整理出:Nginx+jvm+MySQL+Docker+Spring实战技术文档
查看>>
腾讯T4专家精心整理:大数据+机器学习+数据挖掘+算法大集结
查看>>
阿里P8终于总结出:SpringBoot+Tomcat+Nginx+Netty面试题及答案
查看>>
阿里P7大牛,深入剖析JVM底层设计原理+高级特性pdf,附46页ppt
查看>>
史上最全141道大数据面试题:Redis+Linux+kafka+Hadoop,附答案
查看>>
一文带你深入理解JVM,看完之后你还敢说你懂JVM吗?颠覆you认知
查看>>
这些大厂面试真题你能答出来,年薪至少30-50W,想不想挑战一下?
查看>>
携程T7用637页PDF,解读十余热门技术领域,八场携程技术沙龙干货
查看>>
开发框架SpringBoot:构建SpringBoot工程+配置文件详解+Actuator
查看>>
6年拉力工作经验,学了阿里P8级架构师的7+1+1落地项目,跳槽阿里年薪直接40W+
查看>>
90天吃透阿里P8推荐的625页Java编程兵书技术实战,直接入职阿里定级P6
查看>>
清华毕业扫地僧,用157集终于把java给讲完了,总计3.13GB
查看>>
清华毕业大佬用了一个项目就把SpringMVC+Spring+MyBatis给讲完了
查看>>
终于学完阿里P8架构师多年实战经验总结分享微服务之道实战文档
查看>>
年薪120W的架构师简历你见过吗?java程序员该如何达到?
查看>>
超赞!80W美团架构师7年心血终成轻量级框架SSM整合开发实战文档
查看>>
超赞!终于学完了阿里P8架构师7年心血整理总结的微服务实战文档
查看>>
真666!阿里资深架构师熬夜纯手写的238页微服务容器化开发实战笔记
查看>>