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....
They are running amok.
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)
It's almost like someone put a bug into jquery.min.js but I seriously doubt that, because then everyone would get it.
Any ideas? I tried debugging everything I could and I still have no idea what causes this?!?
UPDATE
I replaced all <button><md-tooltip>text</md-tooltip></button>
with <button data-toggle="tooltip" title="text"></button>
This removed 99% of all the violations.
To fix this audit, add a passive: true flag to every event listener flagged by GTmetrix. For example, document. addEventListener('touchstart', onTouchStart, {passive: true});
Consider marking event handler as 'passive' to make the page more responsive. Hammer(element[0]). on("touchstart", function(ev) { // stuff }, { passive: true });
Passive event listeners are an emerging web standard, new feature shipped in Chrome 51 that provide a major potential boost to scroll performance. Chrome Release Notes. It enables developers to opt-in to better scroll performance by eliminating the need for scrolling to block on touch and wheel event listeners.
Touch and wheel event listeners are useful for tracking user interactions and creating custom scrolling experiences, but they can also delay page scrolling.
This solve the problem to me:
jQuery.event.special.touchstart = { setup: function( _, ns, handle ){ if ( ns.includes("noPreventDefault") ) { this.addEventListener("touchstart", handle, { passive: false }); } else { this.addEventListener("touchstart", handle, { passive: true }); } } };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With