在滚动阻止的"touchstart"事件中添加了非被动事件侦听器 [英] Added non-passive event listener to a scroll-blocking 'touchstart' event

查看:880
本文介绍了在滚动阻止的"touchstart"事件中添加了非被动事件侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天突然,我突然无所事事地开始在我们网站的每个页面上看到此内容

Suddenly today out of nowhere I started getting this one on every page on our website

Added non-passive event listener to a scroll-blocking 'touchstart' event.
Consider marking event handler as 'passive' to make the page more responsive

它不仅仅是一次或两次..它就像成千上万的人....

And its not just once or twice.. its like thousands of them....

他们正在横行.

阻止违规泛滥的唯一方法是对此行进行注释

The only way to stop the flood of violations is to comment out this line

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>

我阅读了其他文章,了解这种违规的含义,但我真的看不到我在两个小时之前和现在之间做了什么不同的事情(我进行了完整的回滚只是为了看看是否有帮助)

I read the other posts on what this violation means, but I really cannot see that I did anything different between two hours ago and now (I did a full rollback just to see if it helped)

这几乎就像有人在jquery.min.js中放入一个错误,但我严重怀疑导致所有人都将其获取的原因.

Its almost like someone put a bug into jquery.min.js but I seriously doubt that cause then everyone would get it.

有什么想法吗?我尝试调试所有可能的方法,但我仍然不知道是什么原因造成的?!?

Any ideas? I tried debugging everything I could, and I still have no idea what causes this?!?

更新

我替换了所有<button><md-tooltip>text</md-tooltip></button>宽度<button data-toggle="tooltip" title="text"></button>,这消除了所有违规的99%.

I replaced all <button><md-tooltip>text</md-tooltip></button> width <button data-toggle="tooltip" title="text"></button> This removed 99% of all the violations.

推荐答案

好吧,对此进行更多的挖掘,这不是一个新的行为,前一阵子已经报道过,jQuery仍未解决.

Ok digging this up a little more, this is not a new behavior, it has been reported a while ago and jQuery still hasn't fixed it.

问题在于,要使处理程序成为passive,必须确定从不调用preventDefault(),但是jQuery事先不知道...

The problem lies in the fact that for an handler to be passive it has to be certain of never calling preventDefault() but jQuery doesn't know in advance...

我唯一可以给您的提示是更改控制台日志记录级别并删除详细".跟踪此问题,以获取解决此问题的想法.

The only tip I could give you is change your console logging level and remove "Verbose". Follow up on this issue for ideas on solving this.

这篇关于在滚动阻止的"touchstart"事件中添加了非被动事件侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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