I don't want to use the flag algorithm suggested in jQuery: Detecting pressed mouse button during mousemove event. Because if the user drags the mouse button outside the browser window and release it there, when the mouse comes back to the browser window, it is still thought to be pressed. Then I have to add handlers for when the mouse leaves the window as well and it's too much. Is there a simpler way to know which mouse button is pressed in the event handler of

I would imagine because its a move event it wasn't considered paramount or efficient to find out what key was pressed at the time especially since the event is fired so frequently. So you need to have an event for mouseup and mousedown.