kanaka/noVNC — pull request #223 by jalfd (2013-01-30 15:50:16+00:00)
Title: Receive mouseup events if mouse moves outside noVNC canvas

If you press and hold the mouse button, then move the mouse outside the canvas, and release the button, the mouseup event is never received by noVNC. If you were doing something like a drag&drop operation, this means that the drag operation continues after you've released the mouse button (until the *next* time you press and then release the mouse).

These commits add the necessary code to ensure such mouseup events are received, by:

- capturing the mouse onmousedown in browsers that support it (primarily for the sake of IE, which otherwise never sends mouse events if the mouse is outside the browser window)
- registering a handler for the window.onmouseup event, to get mouseup events regardless of where they occur
- adding a check to ensure that mouseup events from outside the noVNC canvas are discarded if we have not previously received a mousedown (so mouse clicks where both mousedown and mouseup occur outside the canvas are ignored).

I have tested this in Firefox, Chrome and IE9