mousemove
根据 w3c 的 mousemove 规范:
The mouseover event occurs when the pointing device is moved onto an element.
即只有当鼠标(pointing device)在某个元素上移动时才会触发。
click
以及 click 规范,点击事件和 mouse(down,up)事件有很大的关联性:
The click event occurs when the pointing device button is clicked over an element. A click is defined as a mousedown and mouseup over the same screen location. The sequence of these events is:
mousedown
mouseup
click
在触发 click 事件前必定会先触发 mousedown 与 mouseup。
weird mousemove in chrome
但是目前根据我的测试,chrome 8 在 click 的情况下又自作主张地在 mouseup 上面又加了个 mousemove 事件(确实chrome下即使单纯点击,光标也会有点闪动,难道这也算作移动了??),在拖放 实现中就要小心点了。
感想:
做前端工程师真的很累,想完美点就会累死人,还不说目前形形色色的外壳浏览器们。只能期求浏览器发布商在开发中多多遵守规范吧。
PS : 确实在某些机器上触发不了 mousemove,真的奇怪了,分析下原因
1.桌子不稳,其他浏览器都有防抖功能。
2.鼠标有问题,换了个鼠标确实chrome下问题减轻了,按下时光标不会发生变化了,但mousemove仍然会不时产生。