0

I have some code that when a class is created an eventlistner is created. However it is not working in chrome. It works as it should in other webbrowsers. Every element is and option in a select.

I do get this warning:

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

Code:

class Form_signal_sender{
    constructor(element){
        console.log("constructor");
        element.addEventListener("click",function(){
            console.log("Clicked");
            var data = element.getAttribute("data-signal");
            var even = new CustomEvent('signal', {'detail': data}, false);
            window.dispatchEvent(even);
        },{passive: true})
    }
}
Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
Olof
  • 776
  • 2
  • 14
  • 33
  • Are you sure this is the code causing the error? The message says it's about a "mousewheel" event, but this listener is for a "click" event. – Barmar Jun 05 '17 at 15:12
  • Related: https://stackoverflow.com/questions/37721782/what-are-passive-event-listeners – Barmar Jun 05 '17 at 15:13
  • @Barmar Yes I am sure, the warning says that on all events not "passive" I also before found that question and the solution was `{passive: true}` Still not working – Olof Jun 05 '17 at 15:47
  • But the code you posted is passive. – Barmar Jun 05 '17 at 15:52
  • So marking the mousewheel event as passive doesn't fix it? – Barmar Jun 05 '17 at 15:55

0 Answers0