1

This has to be the simplest jsFiddle ever: https://jsfiddle.net/os0xfbu2/3/

window.addEventListener(
    'mousemove', 
    function (e) { 
        // triggered even the mouse is not moving, the window is not scrolled, etc
    })

This is just a lousy mousemove event with nothing in page.

To replicate the behavior, just move your mouse in the HTML zone, and let it sit there, and don't move it and don't scroll the window.

You will see that every couple of seconds, the mousemove event is triggered a few times (about 2 in chrome, and in IE from 2 to 10 ten times sometimes).

Also notice in the jsFiddle that I printed out the X and Y document (absolute) coordinates, and they don't change.

My Chrome version is 42.0.2311.152m and my IE version is 11.0.9600.17633 (tested on both 32 and 64). A friend tested it in an older version of Chrome, it worked fine (no triggering) but after updated his Chrome version to the latest, the same problem started appearing.

Firefox is the only sane browser which doesn't trigger any 'move' event when nothing is moving.

If this is found in some specification somewhere, I quit my job as a programmer.

If not, let me know so I can submit this as a bug.

Tiborg
  • 2,304
  • 2
  • 26
  • 33
  • Try lifting the mouse off the desk :) - I'm guessing Firefox does some more rounding on the coordinates it gets from the OS, which gets them from the mouse driver. – Sergiu Paraschiv May 14 '15 at 10:30
  • I took out of my mouse's batteries, I unplugged it, same happens. There are at least 5 people who reproduced the issue. Also as I said in the post, the mouse coordinates don't change. – Tiborg May 14 '15 at 10:34
  • Could it be something to do with the fact that the result window in JSFIDDLE runs in an iFrame, maybe the way the page updates caused that event to fire again? Have you tried it on a completely local webserver? – Josh Stevenson May 14 '15 at 10:40
  • Yes, actually the reason I investigated this problem was that I was working on a project, had a console.log on a mousemove handler, and I didn't understand why I got logs even though I didn't move the mouse. With no iFrames, just a regular web page. And that's why this problem bothers me so much, because it makes debugging difficult. – Tiborg May 14 '15 at 10:44
  • possible duplicate of [jQuery mousemove() is called even if the mouse is still](http://stackoverflow.com/questions/4579071/jquery-mousemove-is-called-even-if-the-mouse-is-still) – jcuenod May 14 '15 at 10:45
  • @jcuenod it's not a dupe – Josh Stevenson May 14 '15 at 10:51
  • @JoshStevenson see comments under accepted answer. Admittedly, I don't mind if this is not considered a dupe but I'm going to vote that way because it's a known issue. – jcuenod May 14 '15 at 10:52
  • I cannot reproduce this. Latest Chrome on Ubuntu. – Sergiu Paraschiv May 14 '15 at 11:02
  • It might be an OS issue, because I don't believe Chrome and IE both fire random mousemove events at the same interval. As you said earlier, it seems that this is coming from the mouse driver, and Chrome and IE are too lazy to do some rounding. – Tiborg May 14 '15 at 11:21
  • probably related to: http://stackoverflow.com/a/17819113/2464167 – argaz Jul 28 '15 at 20:23

1 Answers1

1

Have a look at this Tiborg. It's not looking like your faith in humanity / the state of the web is going to be revitalized...

https://code.google.com/p/chromium/issues/detail?id=327114

but at least the bug has already been reported... 2 years ago...

Josh Stevenson
  • 895
  • 5
  • 17
  • This might be the same issue, but mine is even worse. I don't need a mousedown / mouseup combo to reproduce the problem. It is enough to let the mouse in a static position over the document, refresh the fiddle, and the events will be triggered. – Tiborg May 14 '15 at 11:18